indenting XML in vim   Leave a comment

Sometimes I need to look inside XML files which consist of one big line. It’s very impossible, and reformatting takes a time. Fortunately, I’ve found a good solution for vim.

I added to my “.vimrc” file:

map <F2> <Esc>:1,$!xmllint --format -<CR>

Now I can press “F2″ button, and vim indents the text.

More hints on indenting XML in vim: Tip #349: Format your xml document using xmllint.

Posted 2011年07月5日 by gw8310 in vim

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s

%d 博主赞过: