[vim]在vim中格式化xml
From: http://blog.sina.com.cn/s/blog_498a6eeb0100v3km.html
在_vimrc中增加:
"??格式化xml
function Xml()
???set filetype=xml
???:%s/></>\r</g"把><替換成>回車<
???:normal gg=G
endfunction
map?<leader>xml? :callXml()
<?xmlversion="1.0"encoding="GB2312"?><xrpc><xrpchead><version>1.0</version></xrpchead><public_req><rpcmode>0</rpcmode><memcache_key></memcache_key><mq></mq><filesvr><fileflag></fileflag><filename></filename><filemd5></filemd5><zipmode></zipmode></filesvr></public_req><transsvr_req><head><transcode>TRANSMSG_QUERY</transcode><oper></oper><orgcode></orgcode><channel>03</channel><chndate>20111007</chndate><chntime>002930</chntime><transdesp></transdesp></head><querymode><maxrecords>10</maxrecords><resultmode></resultmode><filemode></filemode><offset>1</offset><countall>1</countall></querymode><body><DATE_TRANS>20110726</DATE_TRANS></body></transsvr_req></xrpc>
=================>
<?xmlversion="1.0"encoding="GB2312"?>
<xrpc>
?
???????<version>1.0</version>
???</xrpchead>
???<public_req>
???????<rpcmode>0</rpcmode>
???????<memcache_key>
???????</memcache_key>
???????<mq>
???????</mq>
???????<filesvr>
???????????<fileflag>
???????????</fileflag>
???????????<filename>
???????????</filename>
???????????<filemd5>
???????????</filemd5>
???????????<zipmode>
???????????</zipmode>
???????</filesvr>
???</public_req>
???<transsvr_req>
???????<head>
???????????<transcode>TRANSMSG_QUERY</transcode>
???????????<oper>
???????????</oper>
???????????<orgcode>
???????????</orgcode>
???????????<channel>03</channel>
???????????<chndate>20111007</chndate>
???????????<chntime>002930</chntime>
???????????<transdesp>
???????????</transdesp>
???????</head>
???????<querymode>
???????????<maxrecords>10</maxrecords>
???????????<resultmode>
???????????</resultmode>
???????????<filemode>
???????????</filemode>
???????????<offset>1</offset>
???????????<countall>1</countall>
???????</querymode>
???????<body>
???????????<DATE_TRANS>20110726</DATE_TRANS>
???????</body>
???</transsvr_req>
</xrpc>
總結(jié)
以上是生活随笔為你收集整理的[vim]在vim中格式化xml的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ue的 linux版本,UltraEdi
- 下一篇: httpstat:一个检查网站性能的 c