123
123

Reputation: 1065

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

I love vim, but one of my problems with it is that whenever I use x or d to remove text, it copies the deleted text into the buffer/clipboard.

More specifically, it's a problem when I have some text copied, and then I need to delete a 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 custom command for this?

Thanks!

Upvotes: 9

Views: 1879

Answers (2)

R Sahu
R Sahu

Reputation: 206667

There are more ways than one to solve the problem. One has already been suggested by Vimsha.

Another way to solve the problem is to copy your important text to a named register. Say you wanted to 5 lines of text to be deleted from one place and copied in a different place.

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

Do various other operations.

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

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

Upvotes: 5

usha
usha

Reputation: 29359

Use black hole register

"_d

Setup your own mapping in vimrc like ,d to save some typing

Upvotes: 14

Related Questions