Vim - Activiting HTML snippets on PHP files
Asked Answered
Q

2

6

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?

Quadragesimal answered 9/6, 2010 at 18:9 Comment(0)
F
11

You will need to make it two separate directives.

au BufRead *.php set ft=php.html
au BufNewFile *.php set ft=php.html
Foot answered 11/6, 2010 at 20:45 Comment(1)
I think you can do that in single line, just remove the space between BufRead and BufNewFile.Ploss
S
4

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

au BufRead,BufNewFile *.php set ft=php.html
Springspringboard answered 25/10, 2010 at 9:46 Comment(1)
I think the space after the comma might have been the real problem.Houlihan

© 2022 - 2024 — McMap. All rights reserved.