I am aware of the fact that a delete or change yanks to the current register.Since I do not want that behaviour I make them yank to the Black hole register with these two lines in vim rc file

nnoremap dd "xdd  
nnoremap c "xc

Now I do not want Cto yank to the current register however when I do this

nnoremap C "xC

I cannot get the same effect and the content which is deleted is stored in the current register.


_ is the blackhole register, not x. You're just storing the text in the x register, and in the " register.

nnoremap dd "_dd  
nnoremap c "_c
nnoremap C "_C

You should try getting used to the default behavior of the unnamed register. ddp is a very easy way to swap lines, just as xp is an easy way to swap characters. You won't get things like that if you blackhole the change mappings.

  • 3
    Addendum: If this is something you really want to do, I think you should be using onoremap for some of those mappings such as d. – Tommy A May 2 '16 at 5:14

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.