Zamansky 18: Narrowing and iedit

Mike Zamansky has his latest video up. This time it's on iedit and narrowing. For narrowing, he uses Artur Malabarba's narrow-or-widen-dwim package. I love this package and you should definitely be using it too. It makes narrowing really easy and you don't have to remember all the different key sequences associated with the narrowing commands. It's a real win.

The other half of the video is about iedit. This command lets you edit every instance of a symbol—or more generally, any sequence of characters—at the same time. Zamansky's video is an excellent demonstration of its functionality. If you'd like to see it used in a real-world example, take a look at this post from abo-abo that I wrote about previously. If you haven't seen it before, it will astound you.

One problem with iedit is that it works on an entire buffer, which sometimes includes too much. That's where narrowing comes in. You can narrow to a region or function, say, and have iedit act on just the narrowed portion of the buffer. Again, Zamansky gives a nice demonstration of this.

This is an excellent video and only nine and a half minutes long so it's easy to schedule time to watch it. If you aren't familiar with iedit or narrowing, you can consider it a must see.

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

    IEdit has a number of ways of working on less than the entire buffer, even without narrowing. Try with a C-0 prefix to only match in the current defun, or C-1 to only match in the current line. Once you've highlighted one or more occurrences there are also keys to add more occurrences forward/backward -- take a look at iedit-mode-occurrence-keymap.