Vim如何高效成对编辑
如何更换一对单引号或双引号?
1)一个个查找并且替换,比如Normal下 r‘
2)vim-surround插件https://github.com/tpope/vim-surround
Normal模式下增加、删除、修改成对内容ds (delete a surrounding)cs (change a surrounding)ys (you add a surrounding)
eg:
ys iw " 在单词加上"(中间带空格)cs " ' 把双引号变成单引号(中间带空格)cs ( ] 把(变成](中间带空格)ds ' 删除单引号(中间带空格)
ysiw" 在单词加上"(中间不带空格)cs"' 把双引号变成单引号(中间不带空格)cs(] 把(变成](中间不带空格)ds' 删除单引号(中间不带空格)