48

In Eclipse, if the cursor is over a word and you press Ctrl+K you will jump to the next occurrence of that word in the file.

Is there a similar shortcut in IntelliJ?

Fabrizio
  • 7,603
  • 6
  • 44
  • 104
Kummo
  • 3,602
  • 5
  • 24
  • 29
  • possible duplicate of [IntelliJ navigate to next and previous highlighted variable](http://stackoverflow.com/questions/6281623/intellij-navigate-to-next-and-previous-highlighted-variable) – Artjom B. Jun 26 '15 at 15:34

9 Answers9

50

Find word at caret, default is Ctrl+F3, can be changed in File | Settings | Keymap:

Find word at caret

CrazyCoder
  • 389,263
  • 172
  • 990
  • 904
  • 12
    This sort of works, but it doesn't wrap and it doesn't carry over to the next file. In eclipse its nicer: once you hit ctrl-K it caches the text, so even if you switch to another file when you hit ctrl-K again, it finds the occurrence there (and it wraps). Not that your answer is wrong, just would be nice if intellij would have the same behaviour. – htrufan Nov 26 '14 at 09:52
18

You will need 2 Steps to archive a similar behavior:

Step 1:

Press Ctrl+F3 to start a search for the current selectet text (if no text is selected then the whole word will be taken).

Step 2:

Press F3 to jump to next occurrence or Shift+F3 to jump to the previous.

This approach will even continue the search for the text if you switch to another file. Just press F3 and you will jump to the next occurrence in the other file.

cheneym
  • 4,062
  • 1
  • 16
  • 10
6

Shift+F3 works for me in Android Studio / IntelliJ, in eclipse we were using Ctrl+K

Fabrizio
  • 7,603
  • 6
  • 44
  • 104
Ayaz Ahmad
  • 151
  • 1
  • 5
3

I think Android Studio/IntelliJ doesn't play that well, for me, I changed Android Studio Keymap to Eclipse as I used to (My collection tips) and to use Ctrl+K, I press search the string first:

  • Select the text we want to search
  • Press Ctrl+F, Enter
  • Then can use: Ctrl+K in any file we are on

That's what I'm doing, hope can help someone with that.

Fabrizio
  • 7,603
  • 6
  • 44
  • 104
Osify
  • 2,253
  • 25
  • 42
  • I'm using this solution as well but it's very painful due I need to press Ctrl+F, Enter to update the cache of the search to every new "text" that I want to search for. Someone knows how to find the next reference of a selected string without use the search command? Thanks a lot – GFPF Aug 10 '20 at 19:45
3

You can do it using macros:

  • Edit -> Macros -> Start Macro Recording
  • Edit -> Find -> Find Word at Caret
  • Edit -> Find -> Find Next/ Move to Next Occurrence
  • Edit -> Macros -> Stop Macro Recording
  • Give some name for the macro, e.g. "simulate Eclipse Ctrl+K"
  • File -> Settings -> Keymap -> Find the macro "simulate eclipse Ctrl+K" -> bind hotkey Ctrl+K

The same can be done for the Ctrl+Shift+K (use Find Previous/ Move to Previous Occurrence).

Fabrizio
  • 7,603
  • 6
  • 44
  • 104
2

Keymap : Mac OS X 10.5+

  • To start / add to your discrete multiple selection : CTRL+G
  • To skip the current selection and move to the next : CMD+G

Refer: Does IntelliJ have a `Ctrl` + `K`,`Ctrl` + `D` Sublime equivalent? How do I skip a match when using Alt+J for multiple selections in Android Studio?

Misha Akopov
  • 12,241
  • 27
  • 68
  • 82
bluearrow
  • 856
  • 2
  • 11
  • 26
1

There are 2 options like below in : Settings -> Keymap -> Main menu -> Find

  • Find Next / Move to Next Occurrence
  • Find Previous/ Move to Previous Occurrence

For me, this didn't work at the start because GIT push shortcut was using the same keys (Ctrl + K & Ctrl + Shift + K). All is good after changing the conflicting GIT shortcuts.

Keshan Nageswaran
  • 8,060
  • 3
  • 28
  • 45
dds
  • 139
  • 1
  • 2
  • 14
1

enter image description here

You need to first do Ctrl+F on the selected word, now this gets cached then you can use the Ctrl+L and ctrl+shitf+L for going down and up respectively. This is already present. its just that instead of ctrl+K you got use ctrl+L. small change same effect

0

In IntelliJ, if the cursor is over a word and you press Command+G you will jump to the next occurrence of that word in the file. Similarly, you press Command+Shift+G you will jump to the previous occurrence of that word in the file

Misha Akopov
  • 12,241
  • 27
  • 68
  • 82
abhishek ringsia
  • 1,970
  • 2
  • 20
  • 28