Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

技巧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