Does there exist a register, option… to get the last word deleted (dw)?
Suppose that I have this line:
word_1, word_2, word_3
I place the cursor on w of word_2 and dw and I get:
word_1, , word_3
So I press xx to delete the , followed by a space.
I can’t use p or P to paste word_2 because it contains a space.
I know that I could use a register to copy word_2 into it and use " to paste word_2.
Thanks
=============================================
EDIT
While googling
delete register vim
I found this interesting related question:
In vim is there a way to delete without putting text in the register?
There is only one register keeping the data deleted within a line :
""(well there is also"-but it is of little use here since it is a copy of “” in this case). [text in italic added afterwards]It is definitely not the universal solution, but I have remapped
xto “delete to nowhere”:This way
ddeletes to delete register andxdoes the same but doesn’t litter delete register, so that I can keep valuable deleted information intact.So in your case I would type:
dw2x<Right>(orxf<Space>) and thenp