I'm trying to achieve both:
- persistent centered cursor (cursor stays in center of a window except when near the line 0 and
- augment the way
evil-window-topwork so that calling those functions scrolls to the corresponding position, then subsequently "re-centers" the cursor. This would be similar to a full page down, divided by 2
How can I do this?
I'm on Emacs version 26.3, and
evil-git-af6ca28, although I don't think these matter much.
I found a centered cursor implementation which works well enough for me (with the exception that it entirely breaks
(setq scroll-preserve-screen-position t scroll-conservatively 0 maximum-scroll-margin 0.5 scroll-margin 99999)
H) no longer work because they depend on
scroll-margin. I'd like to create new functions (and bind them to the same keys,
H) such that
(move-to-window-line -1) (for window bottom) or
(move-to-window-line 0) (for window top) moves to the cursor position (centered in the window).
I've tried modifying
scroll-margin, but I don't think this can be done interactively, and doubt this is the best approach anyway. Next I'm literally looking at just overriding / replacing the definitions for the
evil-window-top functions. How should I do that? I could almost just override the functions, hardcoding
scroll-margin with 0, but this wouldn't handle the cursor position (I think). What is the recommended approach?