Vim: Syntax file not loaded automatically

syntax-highlighting, vim

Solution

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

Problem

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.

Original source