在VIM脚本中缩进XML文件

时间:2014-03-13 17:42:15

标签: xml vim

我正在尝试编写一个漂亮的小GVIM脚本来在Windows上执行以下操作:

" get the contents from the Windows clipboard
put *
" set XML as the type of the current file
set filetype=xml
" put each XML tag on separate lines
%s/>\s\+</>\r</g
" Autoindent the file
gg=G

我停留在最后一个命令:它不能从脚本中运行。是否有相同的效果?

1 个答案:

答案 0 :(得分:3)

:normal命令允许您执行常规命令:

:normal gg=G

有关详细信息,请参阅:h :norm