In Vim is there a way to delete without putting text in the register?

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.


Yep. It's slightly more convoluted than deleting the "old" text first, but:

I start off with..

line1
line2
line3
line4

old1
old2
old3
old4

I shift+v select the line1, line 2, 3 and 4, and delete them with the d command

Then I delete the old 1-4 lines the same way.

Then, do

"2p

That'll paste the second-last yanked lines (line 1-4). "3p will do the third-from-last, and so on..

So I end up with

line1
line2
line3
line4

Reference: Vim documentation on numbered register