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

How do I enable smooth scrolling so that wrapped lines scroll one visual line at a time in Neovim?

Answer

:set smoothscroll

Explanation

The smoothscroll option (Neovim 0.10+) changes how scroll commands like <C-d>, <C-u>, <C-e>, and <C-y> behave when wrap is enabled. Without it, scrolling moves by whole buffer lines — a single wrapped line that spans three screen rows counts as one step. With smoothscroll, each step moves exactly one visual screen row, making it much more predictable when editing prose, Markdown, or log files with long lines.

How it works

set smoothscroll

With this option on, scroll commands advance by one rendered row rather than one file line. The cursor stays in the same relative screen position during scrolling.

To pair it with useful companion settings:

set wrap          " enable line wrapping
set linebreak     " wrap at word boundaries
set smoothscroll  " scroll by visual row

Example

Consider a Markdown file where one paragraph is a very long single line wrapping across five screen rows. With smoothscroll off, pressing <C-e> once jumps the entire five-row paragraph off-screen. With smoothscroll on, it moves exactly one row — the top of the paragraph scrolls away while the rest remains visible.

Tips

  • This option is Neovim-only (added in Neovim 0.10); it has no effect in standard Vim
  • <C-e> and <C-y> also become one-visual-row commands instead of one-buffer-line
  • Navigation with j/k is unaffected; use gj/gk to move by visual rows
  • Particularly useful for writing or editing long-line formats like RST, Markdown, or prose

Next

How do I keep the cursor position synchronized across multiple Vim windows?