IntelliJ navigate to next and previous highlighted

2019-01-23 01:20发布

问题:

In IntelliJ 10.5 I have "Highlight usages of element at caret" enabled. When a variable/method/etc is selected, is there a way to move to the next and previous occurrence? I'm looking for the equivalent of Control-K in Eclipse.

Edit: Shortcut to navigate between highlighted usages simply moves to the next text occurrence, which is different than moving to the next occurrence of the variable/method/etc. If I have the variable foo selected, I want to navigate to the next occurrence of foo and not any piece of text called "foo" (including "foo" in comments, method names, etc).

Also, pressing F3 seems to be buggy. When I press F3, it sometimes searches using the previous searched text and not the currently highlighted text.

回答1:

It's not currently possible, see my question: Shortcut to navigate between highlighted usages.

I even created an issue IDEA-70523 addressing this feature, please vote for it if you can't live without it like me :-).



回答2:

  • F3 or shift+F3
  • ctrl+c, ctrl+f, enter or up and down arrows
  • ctrl+alt+F7

Added this in case people don't look at your edit.



回答3:

Install Identifier Highlighter Reloaded and use Alt + Shift + Up/Down (can be redefined in Keymap settings) :)

After you give it a shot and notice the 'hey, the highlight stays there after I move my cursor out of it' annoyance, consider upvoting this issue :)



回答4:

Vote this request up for make them implement the feature.

http://youtrack.jetbrains.com/issue/IDEA-59638



回答5:

I usually do the following:

  1. Highlight the word
  2. Cmd + F (it will highlight all the matches in file)
  3. Cmd + G (next match)
  4. Cmd + Shift + G (previous match)


回答6:

I found something thay may more suite your needs : alt + mouse-wheel up/down.
It goes to previous / next occurrence of identifier under caret.

Shortcut name is "Go to next highlighted element usage".



回答7:

I could not get any of IntelliJ's native options for Find Next/Previous to behave like in Eclipse. Find Word at Caret comes close, but it only allows you to slurp and find the next word, not previous.

Identifier Highlighter Reloaded also does not behave like Eclipse.

I wrote an IntelliJ plugin to reproduce the exact behavior as in Eclipse. You can find it here: https://plugins.jetbrains.com/plugin/10635-quick-find-plugin