This is not duplicate of delete line in vi, it's asking different question. I'd like to delete a line without cutting it (placing it in clipboard).
I'd like to copy part of line, delete a line and then paste just that part of line somewhere else. Using v3w
, dd
and then p
pastes whole line.
Best Answer
You're looking for the black hole register (
:help quote_
). If you prepend"_
to a delete command, the contents will just be gone. So, to delete and keep the next three words, and then get rid of the entire line, you'd used3w"_dd
.Advanced mapping
That use case of keeping a part of the line while removing the complete line is a common one; I've written a set of mappings for that: