Merge pull request #556 from jwintz/develop

Plain anzu mode
This commit is contained in:
Henrik Lissner 2018-05-04 10:01:11 +02:00 committed by GitHub
commit 7319378d02
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 1 deletions

View file

@ -2,6 +2,37 @@
;; anzu and evil-anzu expose current/total state that can be displayed in the
;; mode-line.
(def-package! anzu
:commands (anzu-mode global-anzu-mode
anzu-query-replace anzu-query-replace-regexp
anzu-query-replace-at-cursor anzu-replace-at-cursor-thing)
:init
(add-transient-hook! #'isearch-mode (require 'anzu))
:config
(setq anzu-cons-mode-line-p nil
anzu-minimum-input-length 1
anzu-search-threshold 250)
(global-anzu-mode +1)
(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))
(def-package! evil-anzu
:requires evil
:init

View file

@ -9,10 +9,11 @@
;; Optional
;;(require 'flycheck)
;;(require 'anzu)
;;(require 'iedit)
;;(require 'evil-multiedit)
(package! anzu)
(when (featurep! :feature evil)
(package! evil-anzu))