Add a file extension to vim syntax highlighting

Posted December 4th, 2009 in Linux, Operating Systems, PHP, Programming by Louie Miranda

I am trying to edit my template files containing *.ctp and on vim, you usually won’t see any syntax highlighting if it is not a known file extension.

So, to activate it for my *.ctp templates. Just add this on your ~/.vimrc file

:syntax on
:filetype on
:au BufNewFile,BufRead *.ctp set filetype=xml

Save and re-edit your *.ctp file.