I have been using Vim for a very long time now, I was never bothered about auto indentation and it was always off. But now I need to try auto indentation and enabled it.
I am having a strange issue that HTML auto indenation inside .php files doesn't work properly. It does work in .html files but not in .php files. I have tried every solution I could found on Google or on Stack overflow.
I have tried following:
- http://vim.wikia.com/开发者_StackOverflowwiki/Better_indent_support_for_php_with_html
- http://www.vim.org/scripts/script.php?script_id=1120
The only solution that work for me is following but it break php auto indentation:
http://www.vim.org/scripts/script.php?script_id=604
The Vim version is: VIM - Vi IMproved 7.2 (2008 Aug 9, compiled Sep 28 2010 07:11:04)
These are the indent scripts loaded when I open a php file:
- 47: /usr/share/vim/vim72/indent/html.vim
- 48: /usr/share/vim/vim72/indent/php.vim
I also tried the spf-13 vim bundle, but that doesn't indent html inside php either.
Try the following link and it seems to be working for me:
https://github.com/2072/PHP-Indenting-for-VIm - pure for PHP
If you want to try PHP + HTML, then
http://vim.wikia.com/wiki/Better_indent_support_for_php_with_html
精彩评论