9

What is the difference between iedit and multiple-cursors?

As far as I can tell they provide basically the same functionality.

1 Answer 1

8

I never used iedit extensively, so I could be unaware of some of its features, but basically iedit is a more interactive search and replace: you can select occurrences of a string in some scope (region, defun, buffer, etc.) and then replace them with something else.

Compared to that, multiple-cursors generalizes in two directions, the second much more important than the first in my opinion:

  • You are not limited to put cursors just at occurrences of some string. You can put cursors wherever you click the mouse, or at the end of a bunch of lines, or at matches of a regexp, etc., or any combination of these locations.

  • Even if you did choose to place cursors just at occurrences of some string, you are not limited to just replacing them with some other string. You can do any Emacs text editing simultaneously at every location. For example, you could transpose the words found around each cursor, or mark the entire defun containing each cursor and comment it out.

Just as iedit can be thought of as an instant-preview version of query-replace, multiple-cursors can be thought of as an instant-preview version of keyboard macros.

5
  • 7
    FWIW I use both. In fact, iedit provides iedit-switch-to-mc-mode so you can select something with iedit and then switch to multiple-cursors if you want. I find iedit is what I want most of the time, but mc is very useful for certain situations.
    – glucas
    Feb 15, 2019 at 19:21
  • Wrong! Iedit does both things flawlessly out of the box in Spacemacs.
    – xged
    Feb 3, 2021 at 5:34
  • Oh, so it's a complete replacement for multiple-cursors now, @xged? I'm surprised it evolved in that direction.
    – Omar
    Feb 3, 2021 at 18:49
  • @Omar The second thing was there before you wrote your answer (idk about the thirst)
    – xged
    Feb 4, 2021 at 5:23
  • 1
    That's odd, I just installed iedit now to test and it seems you can't, for example, use C-M-u to move outside of the sexp containing each match and do something to it. So it definitely cannot substitute for all uses of multiple-cursors. If your marked regions in iedit contain two words, you can certainly tranpose them in all region at the same time, but you can't for example, transpose the last word in each region with the first word after the region. So it doesn't really have all the capabilities of multiple cursors.
    – Omar
    Feb 4, 2021 at 6:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.