Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

up vote 3 down vote accepted

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.

share|improve this answer

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
share|improve this answer
    
It looks suspiciously like my own vimrc ;-) –  romainl Sep 10 '13 at 14:23
    
Indeed you gave the same answer there stackoverflow.com/questions/11993851/how-to-delete-not-cut I received the tip from a collegue so you probably could be the patient zero :) Thanks for that! –  Yannick Sep 11 '13 at 9:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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