tags:

views:

72

answers:

2

I'm working on a PHP project where all files are given the extension '.shtml'. Unfortunately Vim doesn't know to highlight PHP in these files. Is there as way to force Vim to highlight these files as PHP instead of shtml?

+5  A: 

You can add this to your .vimrc

au BufNewFile,BufRead *.shtml set filetype=php

also... the quick-fix when you're already in vim:

:set filetype=php
EMiller
A few secs faster :-))
ldigas
+3  A: 

You can also add something like

<?php /* vim:set ft=php: */

in the beginning of your file. That would make it more or less independent of the local vim settings.

Michael Krelin - hacker
You can also add these modeline options to the end of the files
willoller
willoller, true. either beginning or end.
Michael Krelin - hacker