Format XML in Vim

Approach 1

Type below the commands in editing the xml file

:%s/></>\r

Approach 2

Map the key and press it when editing the xml file. Here take an example by using key F6:

map  :%s/></>\r:0=:$

Reference

http://vim.wikia.com/wiki/Pretty-formatting_XML
http://vim.wikia.com/wiki/VimTip551

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据

Back to Top