Vim用两个单词替换 [英] Vim replace two words with one another

查看:280
本文介绍了Vim用两个单词替换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在vim中用'bar'和'bar'替换'foo'的所有实例?'/

除了使用临时字词进行更改外,您还可以使用废除插件,如下所示:

 :%SubVert / {foo,bar} / {bar,foo} / g 
pre>

How would one replace all instances of 'foo' with 'bar' and 'bar' with 'foo' in vim?

解决方案

Aside from using a temporary word for the change, you could also use abolish plugin like this:

:%SubVert/{foo,bar}/{bar,foo}/g

这篇关于Vim用两个单词替换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆