In relation to this question: Auto indent turns off itself automatically on php files

Vim has a php auto indent script; it behaves in following way: When autoindent is ON - if you open a php script, it disables default autoindent and uses its own logic. But I noticed that if the php file contains escaped html this script stops working. And auto indentation and autocomplete is not working.

Can you confirm that this is indeed so? Is there any way to fix this?

  • I can't reproduce, but I'm also not exactly sure what you're looking for. I have a file test.php that I've put a couple of lines of html in. When I enter the file and do verbose set ai? I get noautoindent Last set from ...indent/php.vim. So the script seems to be working for me. Can you be a little more specific about what's not working and what the expected behavior is? – Tumbler41 Jan 18 '17 at 16:18
  • @Tumbler41 open a php file that only contains PHP code. verbose set ai? will return noautoindent BUT - indentation will still happen because php.vim takes over indenting. Now open file with mixed content, see php.vim indentation breaks! – user10804 Jan 18 '17 at 16:35
  • Might be a good idea to add a few more details about how indentation is broken. Maybe an example of what it does/what you're expecting it to do? – Rich Jan 19 '17 at 13:39
  • Yes, if you could provide an MCVE, that would be very helpful. – Tumbler41 Jan 19 '17 at 17:00
  • @all, the indent is being controlled by indentexpr=GetPhpIndent(), which doesn't look it handles HTML – D. Ben Knoble Feb 8 at 16:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy