feat(emacs): Run :nohl on ESC

This commit is contained in:
Madeleine Sydney
2025-02-02 14:51:04 -07:00
parent f7c1f6c63f
commit a345b5a72d

View File

@@ -49,6 +49,17 @@
;; the echo area. ;; the echo area.
(evil-ex-define-cmd "mes[sages]" #'view-echo-area-messages) (evil-ex-define-cmd "mes[sages]" #'view-echo-area-messages)
;; On ESC, remove highlighted search results.
(defun syd-evil-nohl-h ()
"If any Evil Ex search highlightings are active, remove them and return t.
Otherwise, nil."
(let ((names '(evil-ex-substitute evil-ex-search)))
(if (-any #'evil-ex-hl-active-p names)
(progn (evil-ex-nohighlight)
t)
nil)))
(add-hook 'syd-escape-hook #'syd-evil-nohl-h)
(evil-mode 1)) (evil-mode 1))
(defvar evil-collection-key-blacklist) (defvar evil-collection-key-blacklist)