anzu 
- Description
- Show number of matches in mode-line while searching
- Latest
- anzu-0.66.0.20240928.212403.tar (.sig), 2024-Sep-29, 60.0 KiB
- Maintainer
- LemonBreezes <look@strawberrytea.xyz>
- Website
- https://github.com/emacsorphanage/anzu
- Browse ELPA's repository
- CGit or Gitweb
- Badge
To install this package from Emacs, use package-install or list-packages.
Full description
anzu.el
Introduction
anzu.el is an Emacs port of anzu.vim.
anzu.el provides a minor mode which displays current match and total matches
information in the mode-line in various search modes.
New Maintainer
This package has a new maintainer as of 2024, @LemonBreezes. If you have any questions or concerns, please feel free to open an issue on GitHub or to send me an email.
Screenshot

Requirements
- Emacs 24 or higher
cl-lib0.5 or higher (you don't need to installcl-libif you use Emacs 24.3 or higher)
Installation
You can install anzu.el from MELPA with package.el
M-x package-install anzu
Basic Usage
global-anzu-modeEnable global anzu mode:
(global-anzu-mode +1)
anzu-modeEnable anzu minor mode:
(anzu-mode +1)
anzu-query-replaceSame as query-replace except displays anzu information in the
mode-line.
anzu-query-replace-regexpSame as query-replace-regexp except displays anzu information in the
mode-line.

You can replace key bindings for the standard definitions of
query-replace and query-replace-regexp with their anzu versions by
adding this snippet to your configuration:
(global-set-key [remap query-replace] 'anzu-query-replace)
(global-set-key [remap query-replace-regexp] 'anzu-query-replace-regexp)
anzu-query-replace-at-cursorWorks like anzu-query-replace except the from-string is the symbol
at the cursor.
anzu-query-replace-at-cursor-thingWorks like anzu-query-replace-at-cursor except the replacement is
constrained to the region specified by the variable
anzu-replace-at-cursor-thing. See the variable's description in
the customization section for additional details.
Be careful not to confuse this variable with the identically named function (see below).
anzu-replace-at-cursor-thingLike anzu-query-replace-at-cursor-thing, but doesn't query for
confirmation before making the substitution.
Be careful not to confuse this function with the identically named
customization variable. See the discussion in the
anzu-query-replace-at-cursor-thing section.

anzu-isearch-query-replaceThe anzu version of isearch-query-replace.
anzu-isearch-query-replace-regexpThe anzu version of isearch-query-replace-regexp.
Customization
anzu-mode-lineFace of mode-line anzu information
anzu-mode-line-no-matchFace of mode-line at no matching case
anzu-replace-highlightFace of from-string of replacement
anzu-replace-toFace of to-string of replacement
anzu-mode-line-update-functionFunction which constructs mode-line string. anzu.el puts its output to mode-line. It is called at searching, inputting replaced word, replacing. This must be non-nil.
The function takes 2 integer arguments, current position and total match number. You can get current-state from anzu--state('search, 'replace-query, replace).
(defun my/anzu-update-func (here total)
(when anzu--state
(let ((status (cl-case anzu--state
(search (format "<%d/%d>" here total))
(replace-query (format "(%d Replaces)" total))
(replace (format "<%d/%d>" here total)))))
(propertize status 'face 'anzu-mode-line))))
(custom-set-variables
'(anzu-mode-line-update-function #'my/anzu-update-func))
anzu-cons-mode-line-p(Default is t)Set nil if you want to display anzu information at any position in mode-line.
anzu.el cons search information head of mode-line as default.
For example, show search information tail of minor-mode-alist
(setq anzu-cons-mode-line-p nil)
(setcar (cdr (assq 'isearch-mode minor-mode-alist))
'(:eval (anzu--update-mode-line)))

anzu-mode-lighterMode name in mode-line. Default is Anzu.
anzu-input-idle-delay(Default is 0.05)Delay second of updating mode-line information when you input from-string
anzu-regexp-search-commandsCommands which have regexp input. If the last command is a member of this list,
anzu.el treats input as regular expression.
The default value is '(isearch-forward-regexp isearch-backward-regexp).
anzu-use-migemo(Default is nil)Set to t if you use migemo.
anzu-search-threshold(Default is nil)Threshold of searched words. If there are searched word more than this value,
anzu.el stops to search and display total number like 1000+(as default).
If this value is nil, anzu.el counts all words.

anzu-replace-threshold(Default is nil)Threshold of replacement overlay. If this value is nil,
anzu-minimum-input-length(Default is 1)Minimum input length to enable anzu. This parameter is useful for migemo users.
Searching 1 or 2 characters with migemo is too heavy if buffer is so large.
Please set 3 or higher if you frequently edit such file.
anzu-deactivate-region(Default is nil)Deactivate region at anzu replace command if this value is non-nil. It is hard to see with anzu replace command when region is active.
anzu-replace-at-cursor-thing(Default is 'defun)Describes the type of thing used by the anzu-*-thing functions.
It can be set to any symbol that is a valid argument for the
thing-at-point function, including e.g. defun, word, and
page. See the documentation for thing-at-point for additional
information.
anzu-replace-to-string-separator(Default is "")Separator of to string.
Sample Configuration
(require 'anzu)
(global-anzu-mode +1)
(set-face-attribute 'anzu-mode-line nil
:foreground "yellow" :weight 'bold)
(custom-set-variables
'(anzu-mode-lighter "")
'(anzu-deactivate-region t)
'(anzu-search-threshold 1000)
'(anzu-replace-threshold 50)
'(anzu-replace-to-string-separator " => "))
(define-key isearch-mode-map [remap isearch-query-replace] #'anzu-isearch-query-replace)
(define-key isearch-mode-map [remap isearch-query-replace-regexp] #'anzu-isearch-query-replace-regexp)
Old versions
| anzu-0.65.0.20240928.102032.tar.lz | 2024-Sep-28 | 11.4 KiB |
| anzu-0.64.0.20240201.224751.tar.lz | 2024-Mar-31 | 11.4 KiB |
| anzu-0.64.0.20211003.131125.tar.lz | 2022-Jan-06 | 11.3 KiB |
News
Revision history for anzu.el
Revision 0.64 2020/12/02 nokamoto
- default anzu-search-threshold and anzu-replace-threshold is 1000 (#113)
- support non-contiguous regions like rectangle region (#115)
Revision 0.62 2016/08/18 syohex
- Don't search over bounds(#80)
- Correct variable type attribute(#76 Thanks Matus Goljer)
Revision 0.61 2016/06/17 syohex
- Don't overwrite user's case-fold-search(#75)
- Implement anzu's isearch-query-replace commands(#72)
Revision 0.60 2016/01/31 syohex
- Add replacement threshold(#66)
- Refactoring code
Revision 0.59 2015/10/15 syohex
- Fix replacement around region issue(#63 Thanks akicho8)
Revision 0.58 2015/10/09 syohex
- Fix byte-compile warning(#63 Thanks tarsius)
Revision 0.57 2015/09/29 syohex
- Fix about migemo exception(#62 Reported by kosh04)
Revision 0.56 2015/09/13 syohex
- Fix literal replacement issue(#60 Thanks kosh04)
Revision 0.55 2015/09/11 syohex
- anzu--status declare as buffer local variable
Revision 0.54 2015/08/03 syohex
- Correct removed hook function name. This makes anzu information is shown if anzu-mode
is disabled.
Revision 0.53 2015/05/18 syohex
- Fix raising invalid regexp error issue(Thanks kosh04)
- Valid replaced regular expression in regexp replace commands
Revision 0.52 2015/02/22 syohex
- Fix default input issue(Reported by pronobis)
Revision 0.51 2015/02/18 syohex
- Improve new history feature of Emacs 25
(This feature works on both Emacs 24 and 25)
Revision 0.50 2015/02/11 syohex
- Fix Emacs 24 issue(Reported by LefterisJP)
Can't use both anzu replace commands and builtin replacements commands
Revision 0.49 2015/02/04 syohex
- Fix zero width replacement causes infinite loop issue(Reported by proofit404)
Revision 0.48 2015/01/28 syohex
- Fix case when expression(,(...)) cannot be compiled.
Revision 0.47 2015/01/21 syohex
- Fix displaying wrong current position in replacement commands
Revision 0.46 2015/01/10 syohex
- Refactoring for evil-anzu
Revision 0.45 2015/01/09 syohex
- Disable blink-matching-paren in replace commands
Revision 0.44 2014/12/16 syohex
- Improve replacement commands
- show case sensitive replacement text
- Fix storing replacement history format issue
- We could not use anzu replace commands with normal replacement
commands such as query-replace etc.
Revision 0.43 2014/11/30 syohex
- Re-factoring for using migemo variable(Thanks lunaryorn)
Revision 0.42 2014/11/28 syohex
- Replacement by case sensitive for at-cursor commands
Revision 0.41 2014/10/06 syohex
- Improve checking whether using migemo
Revision 0.40 2014/10/03 syohex
- Fix replace command bug when using '^' or 'no' command
Revision 0.39 2014/09/19 syohex
- Fix bug case when bounds-of-thing-at-point returns nil
Revision 0.38 2014/09/06 syohex
- Improve replace command suggested by DamienCassou
Revision 0.37 2014/08/27 syohex
- Fix for isearch toggle commands and symbol search
- Improve mode line in replacing commands
Revision 0.36 2014/07/04 syohex
- Implement replacement only specified lines
Revision 0.35 2014/04/23 syohex
- Change function name for maintenance
Revision 0.34 2014/03/28 syohex
- Fix replacement issue
Reported by purcell.
Revision 0.33 2014/03/19 syohex
- Fix byte compile warnings for Emacs 24.3
Revision 0.32 2014/03/08 syohex
- Specify Emacs version
Revision 0.31 2014/03/07 syohex
- Enable lexical-binding
- Update requirement cl-lib.el version
Revision 0.30 2014/02/02 syohex
- Fix wrong prompt issue
Revision 0.29 2014/02/02 syohex
- Add no query replace command
- Use cl-lib instead of cl.el
Revision 0.28 2014/01/29 syohex
- Fix ignore case issue
Revision 0.27 2014/01/27 syohex
- Fix non prefix issue
Revision 0.26 2014/01/16 syohex
- Fix #13 issue
https://github.com/syohex/emacs-anzu/issues/13
Reported by fukamachi
Revision 0.25 2014/01/16 syohex
...
...