【发布时间】:2011-10-01 16:47:24
【问题描述】:
这是我正在处理的文本:
line1: 网站 = "a.com";
...
第 3 行:网站 =“b.com”;
...
第5行:网站=“c.com”;
假设我想将所有网站更改为“stackoverflow.com”,我可以这样做:
- 将“a.com”更改为“stackoverflow.com”
- 拉动整行 (Y)
- 转到第 3 行,按 p、k、dd 从缓冲区粘贴并删除旧的“b.com”行。
现在的问题是,由于 dd 将“b.com”放入缓冲区,为了替换 line5,我必须再次拉出整行。
有什么简单的方法可以让我快速用已经拉出的线替换 line3 和 line5 吗?
更新:
感谢您的回答,现在有几种方法可以做到这一点:删除到黑洞,从命名缓冲区中拉出等。我发现这是我最喜欢的方法(我使用键 R 而不是 r,因为有时我需要替换单个字符):
In Vim is there a way to delete without putting text in the register?
我在下面放了一些类似 SO 问题的链接:
How to Delete (desired text), delete (undesired text), and paste (desired text) in Vim
In Vim is there a way to delete without putting text in the register?
【问题讨论】:
-
不要发布您自己的答案作为对问题的编辑。将其作为单独的答案发布。
标签: vim