Correct indentation of HTML and PHP using Vim
This still bothers me. I only just decided that the best work-around (for me personally) is this:
:set filetype=html
And then highlight your text and hit =
. BOOM! HTML formatting succes. (Not ideal, I know, but at least it works.)
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/bundlegit 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
After looking really really hard into all solutions, I found out this plugin:
http://www.vim.org/scripts/script.php?script_id=604
It seems to have solved my problems!!!!!