Tagged profiles

Get Vim syntax highlighting in CakePHP template files

If you use Vim to edit your php files, you’ve probably got some sort of default syntax highlighting for those files that’s helpful in debugging code. Of course, if you use CakePHP, Vim won’t see your .ctp template files as the php/html combination they really are, and you’ll just see plain text. To fix this, you can add the following line into your .vimrc file (usually located in the root of your home directory):

[cc lang=”vim”]autocmd BufRead,BufNewFile *.ctp set filetype=php[/cc]

When you launch Vim, it will now interpret your ctp files as if they were php (which they pretty much are), and you’ll be able to get the same colors and syntax highlighting.