I wanted a certain file to be highlighted as a PHP file despite the fact it was a .html file, and do to this you use the ‘modeline’ feature of Vim.
To do this, on line2 of the file, I put the following
// vim:set filetype=php:
For me, it didn’t work immediatly, the following command showed why though.
:verbose set modeline? modelines?
By default in gentoo, the modeline is disabled in /etc/vim/vimrc, so either remove that line from there, or in your .vimrc put ‘set modeline’. The modelines option tells vim how many llines to look at at the beginning and the end of the file.
For more information, type ‘:he modeline’ in vim to bring up the relivent part of the manual