ui/doom-modeline: reduce redundant anzu config
This commit is contained in:
parent
b0ae905ffd
commit
e6c7c8a8cd
1 changed files with 3 additions and 23 deletions
|
@ -33,33 +33,13 @@
|
||||||
(add-hook 'doom-escape-hook #'anzu--reset-status t)
|
(add-hook 'doom-escape-hook #'anzu--reset-status t)
|
||||||
(add-hook 'iedit-mode-end-hook #'anzu--reset-status))
|
(add-hook 'iedit-mode-end-hook #'anzu--reset-status))
|
||||||
|
|
||||||
|
|
||||||
(def-package! evil-anzu
|
(def-package! evil-anzu
|
||||||
:requires evil
|
:defer t
|
||||||
:init
|
:init
|
||||||
(add-transient-hook! #'evil-ex-start-search (require 'evil-anzu))
|
(add-transient-hook! #'evil-ex-start-search (require 'evil-anzu))
|
||||||
(add-transient-hook! #'evil-ex-start-word-search (require 'evil-anzu))
|
(add-transient-hook! #'evil-ex-start-word-search (require 'evil-anzu)))
|
||||||
:config
|
|
||||||
(setq anzu-cons-mode-line-p nil
|
|
||||||
anzu-minimum-input-length 1
|
|
||||||
anzu-search-threshold 250)
|
|
||||||
|
|
||||||
(defun +doom-modeline*fix-anzu-count (positions here)
|
|
||||||
(cl-loop for (start . end) in positions
|
|
||||||
collect t into before
|
|
||||||
when (and (>= here start) (<= here end))
|
|
||||||
return (length before)
|
|
||||||
finally return 0))
|
|
||||||
(advice-add #'anzu--where-is-here :override #'+doom-modeline*fix-anzu-count)
|
|
||||||
|
|
||||||
;; Avoid anzu conflicts across buffers
|
|
||||||
(mapc #'make-variable-buffer-local
|
|
||||||
'(anzu--total-matched anzu--current-position anzu--state
|
|
||||||
anzu--cached-count anzu--cached-positions anzu--last-command
|
|
||||||
anzu--last-isearch-string anzu--overflow-p))
|
|
||||||
;; Ensure anzu state is cleared when searches & iedit are done
|
|
||||||
(add-hook 'isearch-mode-end-hook #'anzu--reset-status t)
|
|
||||||
(add-hook 'doom-escape-hook #'anzu--reset-status t)
|
|
||||||
(add-hook 'iedit-mode-end-hook #'anzu--reset-status))
|
|
||||||
|
|
||||||
;; fish-style modeline
|
;; fish-style modeline
|
||||||
(def-package! shrink-path
|
(def-package! shrink-path
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue