Mean in green
I'm Kevin. I live in Salem, Mass with my wife and little boy and I build software.

Drupal/Vim users, highlight your .module files

Thursday Jul 09, 2009

I live in Vim, but finally got tired of editing my .module files without syntax highlighting - ugh. Turns out all you have to do is tell vim what the file is so that it knows what to shade.

Make sure that the following is in your vimrc file - notice the filetype on line: " Switch syntax highlighting on, when the terminal has colors " Also switch on highlighting the last used search pattern. filetype on if &t_Co > 2 || has("gui_running") syntax on set hlsearch endif

Then place the following in ~/.vim/filetype.vim, restart Vim and you are all set! " ~/.vim/filetype.vim " tell Vim what a .module file is if exists("did_load_filetypes") finish endif augroup filetypedetect au! BufRead,BufNewFile *.module setfiletype php augroup END