3

Vim has an option called scrolloff (e.g. set scrolloff=7) which automatically scrolls down or up to keep the cursor/point from getting within a certain distance of the top or bottom of the window.

Is there a way to emulate this behavior in vanilla Emacs / evil mode? (preferably without advising every function that's capable of moving the point)

Emacs is capable of scrolling line by line (e.g. C-u 1 C-v and C-u 1 M-v), but the default behavior seems to be to scroll by full or half screens (maybe to limit the number of times that the entire screen needs to be updated?).

5

The variable scroll-margin controls this behaviour:

Number of lines of margin at the top and bottom of a window. Recenter the window whenever point gets within this many lines of the top or bottom of the window.

You can customize this variable.

By default, it is set to 0, but if you set it to 7 you'll get the behaviour you're describing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.