SurvivalMachine
SurvivalMachine

Reputation: 8356

Vim: Syntax file not loaded automatically

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.

Upvotes: 11

Views: 3961

Answers (1)

Adam Katz
Adam Katz

Reputation: 15901

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

Upvotes: 6

Related Questions