Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Combined HTML, PHP and Javascript indenting and syntax highlighting in vim

I use vim for web development. These are almost always .php files, which also contain HTML and sometimes Javascript. While working in a block of PHP, indenting works fine. The syntax highlighting is okay, but only really useful for the PHP-code. When I want to edit an HTML block, I usually switch: :set ft=html, so that highlighting and indenting work well for that. Of course, I keep switching back and forth, which is time-consuming. I'd like to have all three languages' highlighting and indenting intelligently combined. Being able to =G the whole file at once and have it work for each block according to its own rules would be fantastic.

While I know that "I can do this myself", I somehow doubt that I'm the first person wanting this, and I'm looking for an existing solution.

Can anyone help me out?

like image 896
stephenhay Avatar asked Oct 29 '09 09:10

stephenhay


1 Answers

I haven't tried this, but what about Better indent support for php with html.

like image 51
mrchucho Avatar answered Sep 27 '22 15:09

mrchucho