vimtricks.wiki Concise Vim tricks, one at a time.

How do I reduce the jarring jump when the cursor reaches the screen edge by making Vim scroll multiple lines at once?

Answer

:set scrolljump=5

Explanation

When scrolloff is 0 and the cursor moves just past the screen boundary, Vim scrolls by exactly one line, which can feel abrupt during rapid navigation. Setting scrolljump to a value greater than 1 tells Vim to scroll by that many lines whenever the cursor goes off-screen, providing more context on each scroll.

How it works

  • scrolljump sets the minimum number of lines Vim scrolls when the cursor moves off the visible area
  • A value of 1 (the default) scrolls one line at a time
  • A value like 5 scrolls 5 lines at a time, revealing more of the file in the direction you are moving
  • Negative values set a percentage: :set scrolljump=-50 scrolls half a screen at a time

Example

" In your vimrc:
set scrolljump=5

With this set, pressing j when the cursor is on the last visible line causes the view to jump 5 lines down instead of 1. This is especially useful when navigating large files quickly with repeated j/k presses or when scrolloff is set to 0.

Tips

  • Pair with set scrolloff=5 for a margin above/below the cursor — this often makes scrolljump less critical, but the combination can still feel smoother
  • Use negative values for proportional scrolling: set scrolljump=-25 scrolls 25% of the window height
  • The setting only affects scrolling triggered by cursor movement off-screen; <C-d>, <C-u>, and <C-f> have their own scroll amounts controlled by scroll and window height

Next

How do I paste the contents of a register as a new line below the cursor regardless of the register type in Vim?