This is my own anzu.el implementation
anzu2.el
is an Emacs port of anzu.vim.
anzu2.el
provides a minor mode which displays current match and total matches
information in the mode-line in various search modes.
Enable global anzu mode:
(global-anzu2-mode +1)
Enable anzu minor mode:
(anzu2-mode +1)
Same as query-replace
except anzu information in mode-line
Same as query-replace-regexp
except anzu information in mode-line
Add following S-exp in your configuration if you want to use anzu's replace commands by default.
(global-set-key [remap query-replace] 'anzu2-query-replace)
(global-set-key [remap query-replace-regexp] 'anzu2-query-replace-regexp)
Screencast of anzu2-query-replace-at-cursor-thing
Same as anzu2-query-replace
except from-string is symbol at cursor
Same as anzu2-query-replace-at-cursor
except replaced region is
specified by anzu2-replace-at-cursor-thing
.
Same as anzu2-query-replace-at-cursor-thing
except not query.
This command is useful in refactoring such as changing variable name
in the function.
Anzu version of isearch-query-replace
Anzu version of isearch-query-replace-regexp
Face of mode-line anzu information
Face of mode-line at no matching case
Face of from-string of replacement
Face of to-string of replacement
Delay second of updating mode-line information when you input from-string
Commands which have regexp input. If the last command is a member of this list,
anzu2.el
treats input as regular expression.
The default value is '(isearch-forward-regexp isearch-backward-regexp)
.
Threshold of searched words. If there are searched word more than this value,
anzu2.el
stops to search and display total number like 1000+
(as default).
Threshold of replacement overlays.
Minimum input length to enable anzu.
Thing at point of anzu2-query-replace-at-cursor-thing
.
This parameter is same as thing-at-point
.
(require 'anzu)
(global-anzu2-mode +1)
(set-face-attribute 'anzu2-mode-line nil
:foreground "yellow" :weight 'bold)
(custom-set-variables
'(anzu2-search-threshold 1000)
'(anzu2-replace-threshold 50))
(define-key isearch-mode-map [remap isearch-query-replace] #'anzu2-isearch-query-replace)
(define-key isearch-mode-map [remap isearch-query-replace-regexp] #'anzu2-isearch-query-replace-regexp)