In trying to get vim
to indent .html
files properly, I followed the examples set out here.
Given the following file index.html
:
<html>
<body>
<p>
text
</p>
</body>
</html>
I tried opening it like so (ignoring my .vimrc
to make sure it isn't interfering negatively)
vim -u NONE index.html
Then I set the options to enable automatic indenting:
:filetype plugin indent on
:set filetype=html # abbrev - :set ft=html
:set smartindent # abbrev - :set si
And then I indented the entire file with gg=G
, and this is the result:
<html>
<body>
<p>
text
</p>
</body>
</html>
I checked to make sure that the html.vim
file existed, and it's definitely there
$ head -2 ~/.vim/after/ftplugin/html.vim
" Vim syntax file
" Language: HTML
$ head -2 ~/.vim/ftplugin/html.vim
" Vim syntax file
" Language: HTML
My version of vim is 7.4:
$ vim --version | head -1
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Sep 23 2013 16:12:20)
And it includes smart indent:
$ vim --version | grep smartindent
-ebcdic +mouse +smartindent +xim
I'm at a loss as to why the indentation isn't working! Any clues or ideas to research this problem further?
FWIW, I'm running Ubuntu 13.04.