Keep the cursor in the middle of the screen in Vi

set scrolloff=10

The command keeps the cursor in the area which is off 10 lines from the top and 10 lines from the bottom.
If the number is big enough, then the cursor stays in the middle while typing.

set so=100

The exception is at the beginning and the end of a file where the cursor moves to the first or the last line.

Keep the cursor in the middle of the…
Tagged on:

Leave a Reply

Your email address will not be published. Required fields are marked *