我之前的问题似乎有点模棱两可,我重新表述一下:
我有一个这样的文件:
copythis abc
replacethis1 xyz
qwerty replacethis2
hasfshd replacethis3 fslfs
And so on...
注意: replacethis1、replacethis2、replacethis3、... 可以是任何单词
如何使用最少的 vim 命令将 "replacethis1","replacethis2","replacethis3",.. 单词替换为 "copythis" 单词。
我可以做的一种方法是通过以下步骤:
- 使用 'dw' 删除 "replacethis1","replacethis2","replacethis3",..
- 使用 'yw' 复制“copythis”
- 将光标移动到“replacethis1”所在的位置并执行“p”;将光标移动到“replacethis2”所在的位置并执行“p”等等...
在 VIM 中是否有更好的方法(使用较少数量的 vim 命令)?