Search code examples
intellij-idea

IntelliJ IDEA search for next occurrence of selected text


In Eclipse I can highlight text in the editor such as "foobar" and then hit Ctrl+K, and Eclipse will automatically do a "find next" operation as if I had originally searched for "foobar". I don't have to do a separate "search" operation for the selected text. How do I do this in IntelliJ?

If I switch IntelliJ to Eclipse key mappings, indeed I can press Ctrl+K to invoke the "find next" operation. Unfortunately it ignores the selected text and instead searching again for the last text I searched for.

In other words, with Eclipse mappings in IntelliJ I still have to perform the following steps to do a Ctrl+K search for "foobar":

  1. Select the text "foobar" in the editor.
  2. Hit Ctrl+F for search; IntelliJ will pick up the selected text "foobar".
  3. Hit <Enter> to search once for "foobar".
  4. Hit <Esc> to exit search mode.
  5. Finally hit Ctrl+K to search for the next occurrence of "foobar".

In Eclipse I only have to do this:

  1. Select the text "foobar" in the editor.
  2. Hit Ctrl+K to search for the next occurrence of "foobar" (regardless of what I searched for previously).

How can I get the same "search for next occurrence of selected text" functionality IntelliJ IDEA?


Solution

  • Try the Quick Find plugin, which appears to emulate the Eclipse functionality more closely than the "Next Occurrence of the Word at Caret" action. Caveat: I have not tried it myself.