文本
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,…
技巧97-在多个文件中执行查找与替换 例子:把Pragmatic Vim 都改成Practical Vim
/Pragmatic\ze Vim元字符\ze把单词Vim从匹配中排除掉(见技巧78),然后运行substitute命令
:%s//Practical/g使用:vimgrep在工程范围内查找
/Pragmatic\ze Vim
:vimgrep // **/*.txt查…