如何在 Vim 中删除(想要的文本)、删除(不想要的文本)和粘贴(想要的文本) [英] How to Delete (desired text), delete (undesired text), and paste (desired text) in Vim

查看:53
本文介绍了如何在 Vim 中删除(想要的文本)、删除(不想要的文本)和粘贴(想要的文本)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道这是否是一个智障问题,但这是一个有趣的困境.当我想删除我想放在其他地方的文本,但那个地方有其他一堆我不想要的文本时,我会删除该文本,但在此过程中,我复制了一个新的剪贴板,以便之前删除的文本消失.

I don't know if its a retarded problem but it's a funny dilemma. When I want to delete text that I want to place somewhere else, but that place has other bunch of text that I don't want, I would delete that text, but in the process I copy a new clipboard so the previously deleted text disappear.

有什么建议可以解决这个问题吗?

Any suggestions to solve this?

推荐答案

一些可能的解决方案:

先删除不需要的文字:)

Delete the undesired text first :)

删除所需文本时,将其存储在默认寄存器以外的寄存器中,例如删除当前行末尾所需的文本并将其存储在寄存器b中:

When deleting the desired text store it in a register other than the default register e.g. to delete the desired text to the end of the current line and store it in register b:

"bd$

然后删除不需要的文本.

Then delete your undesired text.

然后粘贴寄存器b的内容:

Then paste the contents of register b:

"bp

按照 Yarek T 链接的答案中的建议,删除不需要的文本到黑洞寄存器,使用:

Delete the undesired text to the black hole register as suggested in the answer linked to by Yarek T using:

"_d

这篇关于如何在 Vim 中删除(想要的文本)、删除(不想要的文本)和粘贴(想要的文本)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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