How do I make half-page scrolling move through wrapped lines instead of jumping over them in Neovim?
Answer
set smoothscroll
Explanation
By default, Neovim's half-page scroll commands (<C-d>, <C-u>, <C-f>, <C-b>) count movement by text lines, not screen rows. When long lines are wrapped, the cursor can jump abruptly past wrapped portions. The smoothscroll option (Neovim 0.9+) changes this so scrolling counts by visible screen rows, which feels much more natural.
How it works
With set smoothscroll enabled:
<C-d>and<C-u>scroll by half the window height in screen rows, not text lines<C-f>and<C-b>scroll by one full window height in screen rows- Wrapped portions of long lines are traversed smoothly rather than skipped
Add to your init.vim or init.lua:
set smoothscroll
vim.opt.smoothscroll = true
Example
With a 200-character line wrapped across 4 screen rows and scrolloff=5:
Without smoothscroll: <C-d> skips the entire wrapped line in one jump.
With smoothscroll: <C-d> steps through each screen row of the wrapped line, keeping context.
Tips
- Only available in Neovim 0.9.0 and later; use
:help 'smoothscroll'to check - Works best combined with
set wrapandset linebreakfor readable wrapped lines - Does not affect
<C-e>/<C-y>(line-at-a-time scrolling) — those always scroll one screen row - Setting
scrolloffto a moderate value (e.g.,set scrolloff=5) combines well for comfortable reading