Anzu mode for incremental find-and-replace

Table of Contents

Shared on the Emacs Tip & Tricks thread 1.

Anzu is great for previewing your query-replace as you go; just remember not to attempt it on HUGE files as the preview (or at least, result counting) gets problematic. Also remember that if you are doing a regexp replace that has side-effects (e.g. incrementing a counter), the preview itself will also do all those side effects before you run the actual replace.

https://github.com/emacsorphanage/anzu

(use-package anzu
  :config (global-anzu-mode 1)
  (setq anzu-minimum-input-length 4))

Footnotes

1 This particular post here: https://www.reddit.com/r/emacs/comments/nqgrpm/weekly_tips_tricks_c_thread/h0kmo6m?utm_source=share&utm_medium=web2x&context=3

Tory Anderson avatar
Tory Anderson
Full-time Web App Engineer, Digital Humanist, Researcher, Computer Psychologist