Is there an easy way within vi
to make your XML text "pretty"?
For example:
I want this..
<person>
<name>Nick</name>
<age>26</age>
<gender>male</gender>
<occupation>doctor</occupation>
</person>
to be this (including the spaces)...
<person>
<name>Nick</name>
<age>26</age>
<gender>male</gender>
<occupation>doctor<occupation>
</person>
I've tried using these commands within vi
:
:set filetype=xml
:filetype indent on
gg=G
But it just removes all of my indentation I had. So now, everything look like this:
<person>
<name>Nick</name>
<age>26</age>
<gender>male</gender>
<occupation>doctor</occupation>
</person>