Adding syntax custom extensions to vim

I'm currently working with cakePHP (a great framework for implementing web-base PHP/Database/Ajax solutions). For that, wanted to enable php syntax highlighting to *.ctp files (View Files).

This is easy, just add the following line to you ~/.vimrc file:

au BufNewFile,BufRead *.ctp set filetype=php

How and why this works, you find in the vim help:

:help au :au[tocmd] [group] {event} {pat} [nested] {cmd}
Add {cmd} to the list of commands that Vim will execute automatically on {event} for a file matching {pat}.
:help BufNewFile When starting to edit a file that doesn't exist.
:help BufRead When starting to edit a new buffer, after reading the file into the buffer.
:help filetype will actually tell this whole story in part B.



Enter your comment. Wiki syntax is allowed:
If you can't read the letters on the image, download this .wav file to get them read to you.