From b17cafc4f7e408ef9157a251486a3ff47f766943 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 6 Jan 2018 03:02:12 -0500 Subject: [PATCH] feature/evil: recenter after splitting --- modules/feature/evil/config.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/feature/evil/config.el b/modules/feature/evil/config.el index 7ca2fff24..1b6f086ad 100644 --- a/modules/feature/evil/config.el +++ b/modules/feature/evil/config.el @@ -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))