I recently found an interesting little package called iedit.el, which allows
you to interactive replacements on multiple strings at the same time. That is,
as you do one replace, you can see how all the same matches being replaced as
you type. It's hard to explain in words, you just have to try it out.
So, how to install this package?
- First, download the package (see the link above)
- Put it in a directory where
emacscan find it; for example,
~/.emacs.d/elisp. If you haven't done so already, you can tell
emacsto look in that directory by adding to your
(setq load-path (cons "~/emacs.d/elisp/" load-path))
- Then, tell emacs to load this specific module; you can add
(require 'iedit)to your
.emacsto load it (alternatively, you could use the autoload facility)
- then, define a key binding for this:
(define-key global-map (kbd "C-;") 'iedit-mode)
- Now, search for some strings that appears multiple times in your buffer, select it,
Ctrl+;), and watch how all other matching strings are
changing at the same time.