VIM: Is there a way to make vim not copy whenever you delete text

I like vim, but one of my problems is that whenever I use x or d to delete text, it copies the deleted text to the clipboard / clipboard.

In particular, this is a problem when I have the text copied, and then I need to delete the second block of text before pasting the first text.

Is there a command that deletes text but does not copy it? If not, is there a user command for this?

Thanks!

+6
source share
2 answers

Use black hole register

 "_d 

Configure your own mapping in vimrc as ,d to preserve some typing

+8
source

There are several ways to solve the problem. Vimsa has already been offered.

Another way to solve the problem is to copy your important text into the named register. Let's say you wanted 5 lines of text to be deleted from one place and copied to another place.

"a5dd will delete 5 lines of text and save them in register a .

Perform various operations.

Now move to the place where you want to copy them.

"ap or "ap will copy 5 lines of text from register a to the current location.

+4
source

All Articles