Emacs-like scrolling in Vim

emacs, vim

Solution

I think this would do what you want:

set sj=-50

check `:h 'sj'` for details:

'scrolljump' 'sj'   number  (default 1)
            global
            {not in Vi}
    Minimal number of lines to scroll when the cursor gets off the
    screen (e.g., with "j").  Not used for scroll commands (e.g., CTRL-E,
    CTRL-D).  Useful if your terminal scrolls very slowly.
    When set to a negative number from -1 to -100 this is used as the
    percentage of the window height.  Thus -50 scrolls half the window
    height.
    NOTE: This option is set to 1 when 'compatible' is set.

Problem

For those unaware, AFAIK by default in Emacs scrolling works the following way. It doesn't scroll until the user has reached the end of the visible buffer, when you reach the end of the visible buffer and you go one over the visible buffer it doesn't load one line, instead it loads an entire new page, basically. I imagine this is to reduce lag when re-rendering the screen. What would be a way to achieve this in Vim? Is there a way to do this? If there isn't, what are some pointers to implement something like this? My idea was to maybe get the best of both worlds and scroll half a page or one page when `scrolloff` is reached. Any help is appreciated. :)

Original source