From 419c3ba1e69c0e1fa9c30eac6b0bc235ff65b535 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 9 Mar 2019 02:43:07 -0500 Subject: [PATCH] feature/evil: recenter window after / * or # --- core/core-editor.el | 2 +- modules/feature/evil/config.el | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/core/core-editor.el b/core/core-editor.el index f21104a58..61a1bfa2f 100644 --- a/core/core-editor.el +++ b/core/core-editor.el @@ -37,7 +37,7 @@ detected.") hscroll-margin 2 hscroll-step 1 scroll-conservatively 1001 - scroll-margin 0 + scroll-margin 2 scroll-preserve-screen-position t ;; Whitespace (see `editorconfig') indent-tabs-mode nil diff --git a/modules/feature/evil/config.el b/modules/feature/evil/config.el index d5974529b..471f97899 100644 --- a/modules/feature/evil/config.el +++ b/modules/feature/evil/config.el @@ -121,6 +121,15 @@ line with a linewise comment.") (advice-add #'evil-open-above :around #'+evil*insert-newline-above-and-respect-comments) (advice-add #'evil-open-below :around #'+evil*insert-newline-below-and-respect-comments) + ;; Recenter screen after most searches + (advice-add! '(evil-visualstar/begin-search-forward + evil-visualstar/begin-search-backward + evil-ex-search-word-backward + evil-ex-search-word-backward + evil-ex-search-forward + evil-ex-search-backward) + :after #'doom*recenter) + ;; --- custom interactive codes ----------- ;; These arg types will highlight matches in the current buffer (evil-ex-define-argument-type buffer-match :runner +evil-ex-buffer-match)