feature/evil: recenter after splitting

This commit is contained in:
Henrik Lissner 2018-01-06 03:02:12 -05:00
parent 60cded00e6
commit b17cafc4f7
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -143,8 +143,10 @@ across windows."
;; `evil-vsplit-window-right' to non-nil mimics this, but that doesn't update
;; window history. That means when you delete a new split, Emacs leaves you on
;; the 2nd to last window on the history stack, which is jarring.
(defun +evil*window-follow (&rest _) (evil-window-down 1))
(defun +evil*window-vfollow (&rest _) (evil-window-right 1))
;;
;; Also recenters window on cursor in new split
(defun +evil*window-follow (&rest _) (evil-window-down 1) (recenter))
(defun +evil*window-vfollow (&rest _) (evil-window-right 1) (recenter))
(advice-add #'evil-window-split :after #'+evil*window-follow)
(advice-add #'evil-window-vsplit :after #'+evil*window-vfollow))