Vim: auto-indent XMLs

Step-by-Step descriptions of how to do things.
Post Reply
User avatar
peter_b
Chatterbox
Posts: 383
Joined: Tue Nov 12, 2013 2:05 am

Vim: auto-indent XMLs

Post 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.
Post Reply