In vim, often I will jump to a mark I made, or a search result, and the cursor will be at the very bottom or very top of the screen. At this point, in order for the screen to b
The 'scrolloff' (scroll offset) option determines the number of context lines you would like to see above and below the cursor. Setting it to, say, 5 makes it so there are always 5 lines visible above and below the cursor while moving/scrolling. Setting 'scrolloff' to a large value causes the cursor to stay in the middle line when possible:
:set so=999
To restore normal behavior, enter:
:set so=0
If you're switching between those a lot, you can create a mapping to toggle quickly:
:nnoremap ts :let &scrolloff=999-&scrolloff " ToggleScrolloff