Reputation: 22705
I was trying to make Gvim highlight syntax of a certain type of file(as Perl) using following command
au BufNewFile,BufRead *.bias setf perl
But as the first line of this file doesn't start with a #!/usr/bin/perl. Gvim is not performing syntax highlighting of Perl. Any solution for this ?
Upvotes: 3
Views: 1597
Reputation: 4778
Try this in your .vimrc (I think Gvim still uses that)
autocmd BufRead *.bias set filetype=perl
If you just want to do it for a single file then try:
:set filetype=perl
Upvotes: 3
Reputation: 7426
Just put the line you already have in ~/.vim/ftdetect/bias.vim
and it should work. I have several custom files I've set up syntax highlighting for in this way and have had no problems.
(Note: if you're on windows, the path would be ~/vimfiles/ftdetect/bias.vim
)
Upvotes: 2