Reputation: 3642
I have a file that is structured as follows (actually the file is much more complex.):
<div id="x">
<div id="y">
<div id="z">
</div>
</div>
</div>
The problem is that vim can't indent what is nested and should be more to the right. Is there some command in vim that could indent it correctly?
The file is partial HTML with *.php extension (Drupal template file).
Upvotes: 4
Views: 830
Reputation: 11711
Place this in your .vimrc file:
filetype plugin indent on
Then open the (html) file in vim and type directly (in command mode): gg=G
See :help filetype-indent-on for more details.
Also there was a similar question here on stackoverflow
Upvotes: 5