about summary refs log tree commit diff
path: root/configs/shared/.emacs.d/wpc
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2020-01-10T20·35+0000
committerWilliam Carroll <wpcarro@gmail.com>2020-01-17T10·56+0000
commit5a1b869af30f85c79ef7f02a3a453af475bad88d (patch)
tree5134d5f58f6cb3b4cd31ec521a7191401fc851ab /configs/shared/.emacs.d/wpc
parenteb748071cadf15ad09fbd7220e240ff878aa9911 (diff)
Ensure isearch and evil-searches center vertically on the screen
I may revert this one day. Checking this in so that one day I can revert it.
Diffstat (limited to 'configs/shared/.emacs.d/wpc')
-rw-r--r--configs/shared/.emacs.d/wpc/packages/wpc-keybindings.el13
1 files changed, 13 insertions, 0 deletions
diff --git a/configs/shared/.emacs.d/wpc/packages/wpc-keybindings.el b/configs/shared/.emacs.d/wpc/packages/wpc-keybindings.el
index 0d3059490f5a..2cae7d3f7092 100644
--- a/configs/shared/.emacs.d/wpc/packages/wpc-keybindings.el
+++ b/configs/shared/.emacs.d/wpc/packages/wpc-keybindings.el
@@ -212,5 +212,18 @@
   (key-chord-mode 1)
   (key-chord-define evil-insert-state-map "jk" 'evil-normal-state))
 
+;; Ensure the Evil search results get centered vertically.
+;; TODO: Consider packaging this up for others.
+(progn
+  (defadvice isearch-update
+      (before advice-for-isearch-update activate)
+    (evil-scroll-line-to-center (line-number-at-pos)))
+  (defadvice evil-search-next
+      (after advice-for-evil-search-next activate)
+    (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))))
+
 (provide 'wpc-keybindings)
 ;;; wpc-keybindings.el ends here