Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim: If editing line in window bottom, also show next 4-5 lines

Tags:

vim

Don't exactly know what to search for: If i edit text in vim it sometimes happen that i edit the last visible line. I'd like also to see the next 5 lines, so i'm looking for something like an "edit margin". Or something like: If i edit the third last line vim should scroll down 2 lines automatic. Would this be possible?

like image 714
John Smith Avatar asked Jul 30 '11 10:07

John Smith


2 Answers

Yes, you can do this using the scrolloff option.

:set scrolloff=5

This keeps 5 lines visible above/below the cursor.

like image 103
hammar Avatar answered Sep 19 '22 16:09

hammar


You're looking for `set scrolloff=5'.

like image 4
Codie CodeMonkey Avatar answered Sep 20 '22 16:09

Codie CodeMonkey