My ~/.vimrc
contains the following line:
au BufNewFile,BufRead *.fsh,*.vsh setf glsl
My ~/.vim/syntax
directory contains glsl.vim
that works if loaded manually (:setf glsl
in Vim), but it doesn't load automatically when editing a file with those extensions. How do I get syntax highlighting for those files automatically? Syntax highlighting works for other files as usual. My Vim version is 7.4 running on Linux Mint.
Add the text, “syntax on” anywhere in the file to enable syntax highlighting permanently for vim editor. Save and close the file by typing ':x'. For disabling the feature, just re-open . vimrc file, change the text “syntax on” to “syntax off” and save the file.
Install the syntax file. Save the file, then install it by copying the file to ~/. vim/syntax/cel. vim on Unix-based systems, or to $HOME/vimfiles/syntax/cel.
If you want to toggle this on/off (without creating a . vimrc file) simply type :syntax on while in vi/vim. Save this answer.
I don't think that line can be in your ~/.vimrc
. Due to loading order, it may have to be in ~/.vim/filetype.vim
instead. Try putting this into that file:
augroup filetypedetect
au BufNewFile,BufRead *.fsh,*.vsh setf glsl
augroup END
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With