2009/04/26

vim中对调某特定字符两边的内容

如如下文本:
awerawedaew -> brthrtywertqwe aoyuilyilyi -> bsdfasfweghtyh asdfasdfasef -> basdfasdf
应用:
:%s/\(.*\) -> \(.*\)/\2 -> \1
结果:
brthrtywertqwe -> awerawedaew bsdfasfweghtyh -> aoyuilyilyi basdfasdf -> asdfasdfasef
\( \) :组 \1 :引用

没有评论:

发表评论