I know that Ctrl + N is to find classes and it is very useful. But what about methods?
-
3possible duplicate of What is Eclipse's Ctrl+O shortcut equivalent in IntelliJ IDEA?– Sachin JainDec 3, 2014 at 6:07
-
It is similar, but it is not exactly the same function. (?)– FelipeDec 3, 2014 at 18:29
-
2For me it is Alt-Cmd-O, Select Navigate->Symbol menu item. Next to it you can see your shortcut.– n0rmzzzMay 31, 2016 at 7:23
17 Answers
ctrl + F12 (cmd + F12 on macOS) will show all members of the current class in a popup window and let you pick up one. It works exactly like the ctrl + o shortcut in eclipse, much faster than ctrl + alt + shift + n
-
69
-
9
-
3What's the name of action to show all members of the current class?– sealskejMay 22, 2014 at 10:18
-
1In fact in Eclipse this is Ctrl+O (Quick Outline). Ctrl+Shift+O is for Organize imports. Aug 8, 2014 at 10:04
-
13
Windows : ^ ctrl + F12
MacOS : ⌘ cmd + F12
Above commands will show the functions/methods in the current class.
Press ⇧ SHIFT TWO times if you want to search both class and method in the whole project.
-
147If you type "sudo grep something /" you can also find anything, on your whole computer :)– olafureMar 2, 2015 at 16:55
-
13@olafure ,yes you can. "sudo grep something /" will search in whole computer and give lot of unnecessary results also will take lot of extra time. So, it's better to search something in IDE only. Mar 3, 2015 at 17:35
-
44I believe that's his point... When looking for methods using the option that will even find text results in files outside of the project is a bit heavy-handed. Mar 18, 2015 at 15:14
-
11While this answer is technically correct, it's what I've been trying to avoid since I don't want to search multiple files which might have the same method name. the Ctrl+F12 method below with like 3x as many upvotes is what should be marked as the correct answer...– dudewadDec 30, 2015 at 17:53
-
1
Ctrl + Alt + Shift + N allows you to search for symbols, including methods.
The primary advantage of this more complicated keybinding is that is searches in all files, not just the current file as Ctrl + F12 does.
(And as always, for Mac you substitute Cmd for Ctrl for these keybindings.)
-
-
-
2
-
Android Studio on Mac
Command + Option + O
Opens up the Symbol lookup that you can jump to most of the methods/functions in your currently opened document.
-
The results displayed using this key combination aren't restricted to the currently open document. For that, cmnd+f12 is what you want (per the answer by Daniel Dang and comment by Thomas).– hBrentJan 14, 2016 at 19:24
-
1For complete clarity, what exactly is the definition of "Symbol" in terms of Android Studio? May 16, 2017 at 19:38
-
@ImpalaTamer Good question. I use it to jump to methods, functions and definitions mostly but it looks like it could bring up more than that. May 17, 2017 at 0:12
-
For those wondering, this action is called "File Structure" in Actions search menu.– ssppjjMay 10 at 14:09
Intellij IDEA 2017.3.4 - 2018.2 (Ultimate) on OSX
CMD + fn + F12
will show all members of the current class in a popup window, then you can search method in that class.
BUT, this answer is depends on your Keyboard setting. If your keyboard setting in
System Preferences > Keyboard > Use all F1, F2, etc. keys as standard function keys
is selected, then the shortcut becomes
CMD + F12
-
I think this should be the correct reply as it gets you to the methods window only, where with further shortcuts we can also see inherited, anonymous and lambdas. Powerful and cool! Thanks– Imam BuxDec 20, 2018 at 10:09
CTRL + F12 brings up the File Structure navigation menu, which lets you search for members of the currently open file.
IntelliJ IDEA Version 12.13 Ultimate Edition:
Macs: command + option + shift + N or on Menu -> Navigate > Symbol ...
-
2
-
1It depends on the keymap you choose in "Preference->Keymap" . it seems you choose the "Mac OS X 10.5+" Apr 13, 2014 at 9:43
Slightly beside the actual question, but nonetheless useful: The Help menu of Intellij has an option 'Default Keymap reference', which opens a PDF with the complete mapping. (Ctrl+F12 is mentioned there)
If you just want to look for methods:
On mac OS X 10.5+ binding, it is Alt + ⌘ + O
By Default XWin Key binding, it is Shift + Ctrl + Alt + N
You can also press double SHIFT then, you can search anything (not only method, but also class, files, and actions)
-
I've removed the tutorial URL. Please don't include the URLs that could be considered as spam.– TusharApr 24, 2016 at 15:26
It is worth adding that if you want to search for a method of a class, you can use a .
(dot) between the class and method name inside of either the search everywhere or search symbols dialog. This even works with IDEAs usual search benefits. For example, you can search for LDT.now
and LocalDateTime::now
will pop up as a result. (As long as you are searching All Files and not just Project Files).
If you click on a method, you can do Ctrl + B to go to that method's declaration. Similar to F12 in MS Visual Studio.
To Find the actions build in the IDEA(reindent, create new, ...) you can use
CRTL+SHIFT+A
then type indent for example and ENTER.
If I need navigate to method in currently opened class, I use this combination: ALT+7 (CMD+7 on Mac) to open structure view, and press two times (first time open, second time focus on view), type name of methods, select on of needed.
I tried SHIFT + SHIFT and ALT + CMD + O
But I think the most powerful and easy to use feature is find in all files CMD + SHIFT + F.
Choose regex and write .*partOfMethodName.*\(
and it shows all places and can see the actual source code in place without going to that specific file.