Mike
Mike

Reputation: 3

Remapping d in vim to delete to null-buffer

I would like to remap d in normal mode to "_d so that it doesn't overwrite my yank buffer. I tried using

:nmap d "_d

but after doing that if I hit d my vim just dies and I can't seem to input anything. Is there any better way to remap this?

Upvotes: 0

Views: 638

Answers (1)

ZyX
ZyX

Reputation: 53654

You should never use *map when you can't answer why you are prefering it to *noremap. Command that does not fall into infinite recursion is

nnoremap d "_d

By the way, yank buffer is 0, not " which is the default for pasting. While d overrides ", it does not do so to 0. y though overrides both " and 0.

Upvotes: 11

Related Questions