Vim – How to Correctly Indent HTML Code in PHP File

htmlPHPvim

In php file :

<?php
...
?>
<html>

</html>

I could not indent the html source code with operator =.

How could I indent it?

Best Answer

My workaround for this is to temporarily switch to html mode, mark region and indent, and then go back to php mode.

:set filetype=html
" mark html code
=
:set filetype=php
Related Question