Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim - Activiting HTML snippets on PHP files

Tags:

vim

snipmate

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?

like image 749
Alfredo Palhares Avatar asked Jun 09 '10 18:06

Alfredo Palhares


2 Answers

You will need to make it two separate directives.

au BufRead *.php set ft=php.html
au BufNewFile *.php set ft=php.html
like image 74
sleepynate Avatar answered Sep 28 '22 18:09

sleepynate


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

au BufRead,BufNewFile *.php set ft=php.html
like image 37
butayni Avatar answered Sep 28 '22 19:09

butayni