tags:

views:

169

answers:

5

I don't know if its a retarded problem but its 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?

+6  A: 

maybe this question might shed some light onto your problem. 54255

It uses the "black hole buffer" to delete lines without adding them to the yank buffer.

Yarek T
+8  A: 

A few possible solutions:

Delete the undesired text first :)

or

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.

Then paste the contents of register b:

"bp

or

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

"_d
mikej
+2  A: 

Another solution is to use the number registers. When you delete a chunk of text it is moved into register 1, the current contents of register 1 is moved into register 2, etc. The contents of register 9 are discarded. However this only works for changes longer than a line, so small deletes are not captured.

So you can delete the first region, delete the second region, then paste from register 2.

Personally I prefer to use registers a-z, but the numbered registers are useful if you delete some text and then realise you forgot to specify a register.

Do :help "1 for more information.

You can also see what is currently in all the registers, including 1-9, with :registers

Dave Kirby
+2  A: 

Type:

:registers

And you'll get a list of registers that contain all previous deletions. You can always pick one to paste. E.g. for registers:

"1   Item1^J
"2   Item3^J
"3   Item2^J

pick the second one and paste it with:

"2p
Aleksa
A: 

Try the yankring plugin.