1

I have mappings to copy/cut/paste to/from register:

nnoremap <c-r><c-c>a "ayy   -- copy current line into register a
nnoremap <c-r><c-x>a "add   -- cut current line into register a
nnoremap <c-r><c-v>a "ap    -- paste from register a

and same for all other registers and modes. I also have usual mappings for c-c/x/v to act as copy, cut and paste to/from unnamed register. Now if I press c-r c-v a quickly, then everything works, but if I press c-r c-v and pause to think which register to use, vim decides to act on c-v instead (performs paste from unnamed register).

Is there a way to make such mappings work without conflict in vim? So that when I press c-r c-v it won't timeout and become c-v.

In standard keymap I think this works via some "waiting-for-register-letter-mode". For instance if I use c-r in command line mode vim displays " and waits for a register letter indefinitely, same in normal mode when pressing ".

EDIT: vim help mentions that remapping c-c in normal mode breaks ability to interrupt scripts. True, but the question still applies when using something else like c-y.

1 Answer 1

1

You either need to :set notimeout to disable behavior completely, or :set timeoutlen=5000 to increase the default timeout to e.g. 5 seconds. See :help map-typing for details

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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