When I press and hold j or k, they are repeated by the OS interface (I presume). Vim seems to scroll on each character produced by the keyboard. This makes the scroll pause shortly right after holding the key down, and then only being repeated at a speed I can not configure for vim.

I would like the scrolling to repeat immediately after holding the key down, and I would like to configure the rate at which the j/k command is executed while the key is being held. So it would be useful to map commands to a key up event, so I could maybe set scrolling on and off when the key is being released.

How could you achieve this?

  • 2
    Afaik, there are no vim-mappable key-up events because terminals dont handle those; some other program (io connected to os, possibly a tty driver or something) does. Instead, I’ll ask this: why are you doing so much scrolling, especially just holding down j? There are other ways to navigate code.
    – D. Ben Knoble
    Dec 31, 2019 at 4:37
  • I just set a short hold delay and fast key repeat for the entire OS. :-) But it's true it's not very Vim-ish. A Vim-ish way to jump around is to use 9j or use the EasyMotion plugin. Jan 3, 2020 at 5:19
  • @D.BenKnoble I have a mapping CTRL-j to 4j, but I don't see anything wrong with scrolling visually. I am frequently just trying to go down a few lines and it is tedious to count how many lines I have to jump and then type in a different key combination each time. I just want to scroll and use visual feedback to know when I'm there. However with vim I would have to endure a short pause before scrolling starts, so I am using my CTRL-j mapping or of course CTRL-d for larger jumps. Some day there ought to be a modern vim-like editor though...
    – stimulate
    Jan 3, 2020 at 15:23
  • What made me notice this was the vim plugin for my browser. there I mapped j and k to scrolling down and up, and this starts to scroll smoothly instantly, which is really enjoyable. There are many UI standards vim doesn't live up to anymore, I only use it because it is the most lightweight and simple (compared to IDEs with vim mode). But I hope we get a vim successor soon.
    – stimulate
    Jan 3, 2020 at 15:27
  • @stimulate searching or using tags is faster; relativenumber avoids counting. I’m not saying its wrong, just less efficient.
    – D. Ben Knoble
    Jan 3, 2020 at 17:05


Your Answer

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

Browse other questions tagged or ask your own question.