Posts Tagged ‘vimrc’

Force vim to use specific file type

Tuesday, September 27th, 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

Vim syntax highlighting for cmake’s CMakeLists.txt files

Tuesday, August 31st, 2010

I use the following at the end of my .vimrc file to force vim to highlight cmake’s CMakeLists.txt files like any other cmake file:


au BufNewFile,BufRead CMakeLists.txt set filetype=cmake

Looks much better than whatever it was trying to do before, which for me was nothing.

Vim syntax highlighting for Qt’s .pro files

Tuesday, July 13th, 2010

I use the following at the end of my .vimrc file to force vim to highlight Qt’s .pro project files like a make file:


au BufNewFile,BufRead *.pro set filetype=make

Looks much better than whatever it was trying to do before.