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
scrolljumpsets 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
5scrolls 5 lines at a time, revealing more of the file in the direction you are moving - Negative values set a percentage:
:set scrolljump=-50scrolls 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=5for a margin above/below the cursor — this often makesscrolljumpless critical, but the combination can still feel smoother - Use negative values for proportional scrolling:
set scrolljump=-25scrolls 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 byscrolland window height