Iedit Video

Tony Aldon has a short, interesting video on iedit. If you’re not familiar with iedit, you should be. It’s one of my favorite refactoring tools and I use where others might use multiple-cursors or query-replace. Like multiple-cursors, once a piece of text is selected, all matching text is also highlighted and changes to any of the instances is made to all the others.

The selection process is interesting. If you place the cursor on some item, the selection is basically what’s returned by thing-at-point. If you select a region, the text in that region is the selection.

Aldon demonstrated something that I didn’t know about iedit: if you specify a zero prefix, iedit will consider the text in the current function only. That makes it easy to refactor a single function. It turns out that iedit has a lot of functionality so you should check out the doc but almost all uses—at least for me—simply involve selecting some text and calling idedit. Then you can edit all occurrences of that text at once.

I’m not sure why iedit isn’t better known. As I said, I find it one of the most useful refactoring tools. If you haven’t already, you should give it a try. Aldon’s video is more than enough to get you started. If you like what you see, read the doc file to get more information.

This entry was posted in General and tagged . Bookmark the permalink.