技巧96-交换两个或更多的单词
文本:
The dog bit the man.
想把dog和man互换:
\v(<man>|<dog>)
:%s//\={"dog":"man","man":"dog"}[submatch(1)]/g
使用Abolish.vim:超级substitue命令
Subvert命令,简写为:S
:%S/{man,dog}/{dog,man}/g
文本:
The dog bit the man.
想把dog和man互换:
\v(<man>|<dog>)
:%s//\={"dog":"man","man":"dog"}[submatch(1)]/g
Subvert命令,简写为:S
:%S/{man,dog}/{dog,man}/g