在 Vim 中,有没有办法在不将文本放入寄存器的情况下进行删除? [英] In Vim is there a way to delete without putting text in the register?

查看:34
本文介绍了在 Vim 中,有没有办法在不将文本放入寄存器的情况下进行删除?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用 Vim 时,我经常想用我刚刚拉取的代码块替换代码块.

Using Vim I often want to replace a block of code with a block that I just yanked.

但是当我删除要替换的代码块时,该代码块本身会进入寄存器,该寄存器擦除了我刚刚删除的代码块.所以我养成了猛拉,然后插入,然后删除我不想要的东西的习惯,但是对于大块的代码,试图将插入的块和要删除的块分开会变得很混乱.

But when I delete the block of code that is to be replaced, that block itself goes into the register which erases the block I just yanked. So I've got in the habit of yanking, then inserting, then deleting what I didn't want, but with large blocks of code this gets messy trying to keep the inserted block and the block to delete separate.

那么在 Vim 中替换文本的最巧妙、最快捷的方法是什么?

So what is the slickest and quickest way to replace text in Vim?

  • 有没有办法删除文本而不将其放入寄存器?
  • 有没有办法说例如替换下一个单词"或替换到下一段"
  • 还是以某种方式使用多寄存器功能的最佳方式?

推荐答案

要删除某些内容而不将其保存在寄存器中,可以使用黑洞寄存器":

To delete something without saving it in a register, you can use the "black hole register":

"_d

当然,您也可以使用不包含您感兴趣的任何内容的任何其他寄存器.

Of course you could also use any of the other registers that don't hold anything you are interested in.

这篇关于在 Vim 中,有没有办法在不将文本放入寄存器的情况下进行删除?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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