简体   繁体   中英

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM