I\'ve been using Vim for a while, and I can\'t get proper HTML indentation working in PHP files.
For example, what I want is for each child to be indented one tab mo
After searching for days for the solution ,nothing worked and finally this worked,add this to your vimrc
au BufEnter,BufNew *.php :set filetype=html
For me it works good if I first do :set ft=html
and then :set syn=php
.
i found this solution is much better. http://www.vim.org/scripts/script.php?script_id=1120
supporting HEREDOC html style. which occur frequently in my code.
BTW:it's has more versions than the old one (script id 604, alex posted it above)
There is a set of vimrc instructions on the Vim Wiki called Better indent support for PHP with HTML that will use the correct plugin depending on the block.
There is also a Vundle/Pathogen Plugin that uses the same code but is easier to install and keeps your .vimrc
clean.
Pathogen
cd ~/.vim/bundle
git clone https://github.com/captbaritone/better-indent-support-for-php-with-html.git
Vundle
Place in .vimrc
Bundle 'captbaritone/better-indent-support-for-php-with-html'
Run in vim
:BundleInstall