Vim - activating HTML snippets in PHP files

I use vim and snipMate, many times I need to name HTML files in PHP only because of 1 or 2 lines of code.

Every time I create a PHP file, vim accepts it as a PHP file, so HTML fragments are not available, so you need to manually activate HTML fragments using the command.

set ft=php.html 

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

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

It is right? Am I missing anything or is something wrong?

+6
vim snipmate
source share
2 answers

You will need to create two separate directives.

 au BufRead *.php set ft=php.html au BufNewFile *.php set ft=php.html 
+11
source share

Your example has an uppercase E. The following should work on one line:

 au BufRead,BufNewFile *.php set ft=php.html 
+4
source share

All Articles