Associating one file extension with another in Vim
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?
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
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.
精彩评论