Force vim to use specific file type
Alec Jacobson
September 27, 2011
I recently download the glsl syntax highlighting plugin for vim. It perfectly recognizes my .vert and .frag files. But as soon as I added the line:
#version 120
vim starting thinking the filetype was not glsl but conf.
The cause seems to be that the glsl plugin suggests a rather weak form of recognizing the filetype. Adding the following to your .vimrc file
au BufNewFile,BufRead *.frag,*.vert,*.fp,*.vp,*.glsl setf glsl
When instead to override whatever vim is doing to think that the file is conf you must use the only slightly different
au BufNewFile,BufRead *.frag,*.vert,*.fp,*.vp,*.glsl set filetype=glsl