Sunday, 15 January 2012

Can vim indent XML without changing the file? -


I've read, but I want to do something different:

  • Do I use Can I indent an entire XML file, but without changing the file. Only one thing should be changed, that is representation, but not the file itself.

For those interested: I work with books in XML format. If the file has changed, it usually happens by adding tabs and / or spaces. It messes up my data (because actually there may be spaces in the tabs or texts).

You have some options:

Change the width of the tab

< P> If you have a tab-based indent in XML, you can change the view format of the indent by changing the 'tabstop' value. This file contains the physical & lt; Tab & gt; does not affect the characters.

Pre- / post process

You can change the amount of indent after typing, and undo it before typing Here is an example which is half / double space: / P>

 : autocmd BufReadPost, BufWritePost *% substitute / ^ \ (\ + \) \ 1/1 / e: autocmd BufWritePre *% substitute / ^ \ + / & Amp; Amp; / E  

No comments:

Post a Comment