0

I find very frustrating in Neovim and vim that when I delete a text to replace it, what actually happens is that it copies the last thing I deleted.

I've tried with this line in my init.vim:

vnoremap d d :let @-=''<CR> 

With that I intended that the register, used to storage what I've deleted, be emptied, but it uses other registers too, which makes this line useless.

So is there anyway to make d and the delete key actually delete something instead of copy?

2
1

:h quote_ :

9. Black hole register "_               *quote_*
When writing to this register, nothing happens.  This can be used to delete
text without affecting the normal registers.  When reading from this register,
nothing is returned.

You could map it like that: vnoremap d "_d

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.