Page 1 of 1

Vim: auto-indent XMLs

Posted: Tue Nov 17, 2015 12:14 pm
by peter_b
I often have the case where I have XML code, but it's not properly indented.
Now usually, vim's super-powers allow "gg=G" - which automagically indents code, according to the filetype syntax.

Here's what you need to do in order to use that for XML:

Code: Select all

:filetype plugin indent on
:set nocompatible
:set filetype=xml
NOTE: These changes to are not permanent in vim. They only work for the current session.