1

The delete command will yank the deleted text, but it's not my expected behavior. I just want to delete the text without overwriting my yanked text. Is it possible to change the default behavior with config? PS: I don't want to use another command to achieve it.

2 Answers 2

3

Yes, d and :d[elete] can be confusing because they behave like "Cut".

To make d "really" delete, you must specify the "black hole register" (:help "_):

"_d

You can map d to "_d:

nnoremap d "_d

but I'd keep the original command as is, though.

1

As romaini said, original command for d is good the way it works and I wouldn't advise to change it.

What you can do though is mapping "_d with <leader>d

In my case leader key is , so instead of pressing "_d I will write ,d

" shortcut to delete in the black hole register
nnoremap <leader>d "_d
vnoremap <leader>d "_d
" shortcut to paste but keeping the current register
vnoremap <leader>p "_dP
2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .