3

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:

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.

1 Answer 1

4

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

Sign up to request clarification or add additional context in comments.

1 Comment

The script in the vim wiki worked perfectly for me. I wrapped it in a Vundle compatible plugin to make it easier to include: github.com/captbaritone/better-indent-support-for-php-with-html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.