Next Occurrence of highlighted identifier?


When I've got the cursor on an identifier (let's say a variable, for now, but the same question holds for any identifier), I can hit Find Usages and then use Prev/Next Occurrence to move from usage to usage.  That's nice, but requires an extra keystroke (Alt-F7 in my case, for Find Usages).  The usages in the current file are already highlighted for me without hitting Find Usages, so is there any way to just jump to the previous or next Occurrence (i.e. the prev/next highlighted occurrence) without having to go through Find Usages first?

I like how Prev/Next Occurrence are always the same buttons/keystrokes in any window, and apply to the things in that window.  So I expected this to be what they meant in the editor window: go to the prev/next occurrence of the thing the cursor is on, and I am surprised that they don't work that way.  Or maybe they do, and I'm just doing something wrong?



The highlighting of usages while editing is a distinct and different option than searching for them and navigating to them. So there is not a way to just jump to the next usage after merely placing your cursor on them. However, rather than using "Find Usages" to do what you want, I'd recommend you use the "Highlight Usages in File" action (Ctrl+Shift+F7) instead. Unlike find usages, that will limit it to the current file (thus reducing any searching), will not open the Find tool window, and will actually highlight all the usages (until you hit "Esc"). You can then use F3 and Shift+F3 to navigate between them.


I know this is an old thread but coming from Netbeans and Visual Sudio I came to appreciate this functionality quite a lot. Are there any plans to implement such a feature? In simple words it should work just like this:

- move the cursor to an identifier (variable, function name etc.)

- highlight all the occurrences (this is already implemented)

- using some shortcuts jump to the next/previous occurrences within the scope.

I'm currently evaluating CLion and I'm missing this feature.



I also like this feature in other editors. I find it useful. I'd like to see it implemented in Pycharm and Clion.


Please sign in to leave a comment.