Last Updated: February 25, 2016
· croaky

Avoiding the edges when scrolling in Vim

When scrolling in Vim, we eventually hit the top/bottom edge of our screen with our cursor. Vim has an option which allows us to always have some lines above the cursor when hitting the top of the screen or underneath when hitting the bottom:

set scrolloff=5

This gives us a five line "border" when scrolling against the edges.