POLYGLOT PROGRAMMING

Better poly than sorry!

Jumping to next/previous occurrence of something at point via iedit ΒΆ

For a very long time I used normal search to get to a next occurence of something. However, it wasn't very comfortable. For this to work, I need to:

  • move point (cursor) to the beginning of a word I'd like to jump to
  • press C-s
  • press C-w, more than once if necessary, to copy current word into search box
  • keep pressing C-s to search for occurences

I found a better way. iedit is a mode for Emacs for editing all the occurences of something at once. I alternate between iedit and multiple-cursors mode when I need to do something simple to a word in many places in the code. However, iedit also provides an iedit-next-occurence, which by default is bound to TAB.

Using iedit I only need to:

  • move point to anywhere inside a word
  • press C-; for iedit
  • press TAB to jump to next and S-TAB (shift + tab) to jump to previous occurence

One more feature of iedit I find useful sometimes is a toggle-unmatched-lines-visible command. It duplicates occur mode functionality a bit, but it hides unmatched lines in your current buffer. This makes it easy to quickly switch between a global occurences list and a local occurence context.

Comments