I am currently try to break inefficient habits, and one bad habit is to keep a button pressed, e.g. keep pressing j to move down approximately 10 lines instead of moving exactly 10 lines down with 10j, or moving across words with h and l instead of doing wordwide movements with web.

In order to make me realize that I am doing something inefficient, I have currently disabled key repeat on my Ubuntu, yet this affects all key-presses in all application. And while this is a smell in most application, it has its uses for some of them; so I am wondering:

How to disable key repeat in vimrc?


This would be not a smart solution, because the hjkl are particularly useful if you are moving 1-2 characters up and down.

Nevertheless, if you want to disable repetition of j for example use this mapping:

nnoremap jj <nop> 

You also may have to set timeoutlen to a low value (set timeoutlen=50)

  • If I want to move the cursor for two characters, I can just use 2l, that's the whole point of the question to use the amount modifier. And I still would be able two press j twice in a short succession. I only want the repeat to stop when keeping the button pressed down.
    – k0pernikus
    Dec 23 '15 at 13:09
  • even with a low setting for timeoutlen, using j for down movement is too slow if you implement this solution. Aug 30 '16 at 20:42

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.