Vim - Activiting HTML snippets on PHP files

倖福魔咒の 提交于 2019-11-29 09:41:17

问题


I am using vim and snipMate, many times I need to name the HTML files to PHP, just because of 1 or 2 lines of code.

I every time I create a PHP file vim takes it as PHP file and so the HTML snippets are not available, thus have to activate the HTML snippets manually with the command.

set ft=php.html

I intend to activate it automatically in this this line on my vimrc

autocmd BufREad, BufNewFile *.php set ft=php.html

Is this correct? I am missing anything or is something wrong?


回答1:


You will need to make it two separate directives.

au BufRead *.php set ft=php.html
au BufNewFile *.php set ft=php.html



回答2:


You have an uppercase E in your example. The following should work on one line:

au BufRead,BufNewFile *.php set ft=php.html


来源:https://stackoverflow.com/questions/3008575/vim-activiting-html-snippets-on-php-files

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!