interactive replacement





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 emacs can find it; for example,

    ~/.emacs.d/elisp. If you haven't done so already, you can tell emacs to look in that directory by adding to your .emacs:

    (setq load-path (cons "~/emacs.d/elisp/" load-path))

  • Then, tell emacs to load this specific module; you can add

    (require 'iedit)
    to your .emacs to 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,

    press C-; (Ctrl+;), and watch how all other matching strings are

    changing at the same time.

Very nice.

No comments:

Post a Comment

Followers

Popular Posts