how to scroll faster in vim

Scrolling while keeping j or k pressed is too slow. Doing 10j multiple times isn't ideal either.

How can I go faster while keeping a key pressed ? I'm using vim for vscode but I imagine the solution probably applies there too.


Solution 1:

If you are looking to speed up the time to get to a specific spot, having many pages. These commands support to keep the keys press if needed to increase speed:

ctrl + f (page down)

ctrl + b (page up)

ctrl + d (scroll window downwards, normally half a a screen)

ctrl + u (scroll window upwards, normally half a a screen)

Solution 2:

I believe you're looking for a better way to navigate between say code blocks or similar sections without having to do recursive j's or k's. These are my personal favorites :

  • Scrolling through screen with the cursor staying on the same line/present line by Ctrl+y and Ctrl+e
  • Moving between paragraphs. Very useful for moving between code blocks(assuming no newline inside the code block :D) like different functions, classes etc by using the { and } keys.
  • The best and fastest way to go to move around is by using the available visual cues like keywords on certain lines etc and searching and moving cursor to that point. You can use the / or ? key to search for a particular word and either press Esc to stop search and move to original cursor position or Enter to go to that searched keyword.
  • Of course you can advance by full screens using Ctrl+F and Ctrl+B.
  • You can directly go to a particular line by typing the line number in normal mode and pressing capital G. eg:- 10G

if you're still wanting to explore more navigation tricks and commands, i strongly recommend you to watch this wonderful talk.