Eclipse: Incremental Find…

GOSH! I just wasted a solid hour trying to remember what Eclipse called their “vi style search/find” find feature. I remembered learning about the “vi” style find a few weeks ago (it was on EclipseZone), but could not remember how to get into the find mode. FYI. If you are looking for it, Eclipse calls it Incremental Find.

Anyhow, the two ways to activate Incremental Find in Eclipse are:
-via the menu system with Edit -> Incremental Find Next or Incremental Find Previous.
-via keyboard shortcut Ctrl-J for forward find and Ctrl-Shift-J for reverse find.

A couple notes on incremental find “odd” behaviors. The first is that when you are searching forward the text you are searching for is highlighted and your cursor is at the end of the string you are searching for. The odd part of this is that if I want to search in an opposite direction, from forward to reverse, the first time I switch the direction my search doesn’t move from one instance of the search term to the next. My cursor just stays on the same search term but moves from the beginning of the term to the end. Yes, I’m being anal here, but it seems like an inefficient movement, just moving the cursor, not moving to the next search term.

Along the lines of the first “odd” behavior. When using incremental find to search for something, and you hit the end of the file, the find doesn’t wrap. The find just lets you know that you hit the end. Then with a second keystroke it wraps to the next search term. I call this “blocking my shot”.

It would be nice if Incremental Find in Eclipse worked a bit more like vi but it’s still a great feature and one that I will be using going forward. And, the main point of this post was to document how to use incremental find, and what it’s actually called (not “the vi kind of find”) so I can talk about it with people.

This Post Has 8 Comments

  1. Tom

    And in Vim, it’s called “incsearch” where “inc” means incremental. So Eclipse isn’t too different in its terminology. (And old-timey vi doesn’t have it.) Anyway, I agree that it’s useful.

  2. Erik Weibust

    Howdy Tom,

    Thanks for stopping by. I agree that incremental search in Eclipse is very similar to that feature in vim, but in vim the search simply wraps when it hits the bottom of the document, or when you switch directions.

    Erik

  3. Frank Merenda

    Nice! I had no idea, and I’ve been using eclipse for over a year now!

    Take care,
    -Frank

  4. Endre Stølsvik

    Both of those features are of course really cool: If you’re searching for a long string, moving to the front of that string is nice to do with just “one additional stroke”. Being informed in rather subtle way that you’re wrapping is of is also nice, so that you don’t believe you’re still searching downward: you’ve actually wrapped.

  5. Rob

    Incremental search seems broken to me. You have to type your search term! In emacs you can start an incremental search and hit control-w to select the next element (like ctrl-shift-right in eclipse). Then you can keep searching for what you just selected. As far as I can tell there’s no way to search for a selection with Eclipse’s incremental search.

  6. Antoine

    Actually, it not as efficient as emacs, but you can find the occurence of a selection by using Ctrl + k

  7. garble blaster

    Hi folks,
    i find the search wrap very unuseful. When i search for a term and i have to examine every occurence its very anoying to press control-k then if another match found look on the scrollbar if it has a higher position than the last search and then memorize the current position of the scrolbar to decide if the next match is behind the previous match. So i use nowrapscan everytime in vim. I wish this were feature a config option in eclipse.

    Just my 2ct.
    Garble

  8. Moe

    It would also be good if one could edit the search term, once you have clicked somewhere. That it is a label rather than a text input is a strange decision by whoever added it. Eclipse sucks.

Leave a Reply