I tried your sample (result below), so vim's html autoformat/indent definitely works with this.
<div>
<span>
</span>
</div>
Here's the steps to do it:
:filetype plugin indent on " enable the filetype indent plugin
:e " re-open the file (very important!)
:scriptnames " make sure you see an ".../indent/html.vim"
:=G " or whatever range you want
scriptnames
is the key to identifying whether the indent/html.vim
is properly loaded. If not, then you probably need to re-open the file.
Note that if you put filetype plugin indent on
in the ~/.vimrc
, then you won't need to re-open the file since that plugin was already enabled before you opened the file.
:filetype plugin indent on
The indent part is important:scriptnames
after you open an HTML file?