Vertically align search results conditionally

Only when `window-system` is set.
This commit is contained in:
William Carroll 2020-09-07 16:12:27 +01:00
parent 3dc10f167b
commit 0f2a13a32a

View file

@ -107,16 +107,19 @@
(global-evil-surround-mode 1) (global-evil-surround-mode 1)
;; Ensure the Evil search results get centered vertically. ;; Ensure the Evil search results get centered vertically.
(progn ;; When Emacs is run from a terminal, this forces Emacs to redraw itself, which
(defadvice isearch-update ;; is visually disruptive.
(before advice-for-isearch-update activate) (when window-system
(evil-scroll-line-to-center (line-number-at-pos))) (progn
(defadvice evil-search-next (defadvice isearch-update
(after advice-for-evil-search-next activate) (before advice-for-isearch-update activate)
(evil-scroll-line-to-center (line-number-at-pos))) (evil-scroll-line-to-center (line-number-at-pos)))
(defadvice evil-search-previous (defadvice evil-search-next
(after advice-for-evil-search-previous activate) (after advice-for-evil-search-next activate)
(evil-scroll-line-to-center (line-number-at-pos)))) (evil-scroll-line-to-center (line-number-at-pos)))
(defadvice evil-search-previous
(after advice-for-evil-search-previous activate)
(evil-scroll-line-to-center (line-number-at-pos)))))
(key-chord-mode 1) (key-chord-mode 1)
(key-chord-define evil-insert-state-map "jk" 'evil-normal-state) (key-chord-define evil-insert-state-map "jk" 'evil-normal-state)