How to indent nested partial HTML tags in Vim?

I have a file that is structured as follows (in fact, the file is much more complicated.):

<div id="x"> <div id="y"> <div id="z"> </div> </div> </div> 

The problem is that vim cannot backtrack from the nested one and should be more right. Is there any command in vim that can backtrack correctly?

The file is partial HTML with the extension * .php (Drupal template file).

+4
source share
1 answer

Put this in your .vimrc file:

 filetype plugin indent on 

Then open the file (html) in vim and type it directly (in command mode): yy = G

See the filetype-indent-on help for more details.

fooobar.com/questions/466461 / ...

+4
source

All Articles