What is the shortcut in IntelliJ IDEA to find method / functions?

286

61

I know that Ctrl + N is to find classes and it is very useful. But what about methods?

Felipe

Posted 2010-09-20T18:31:10.367

Reputation: 10 609

1

possible duplicate of What is Eclipse's Ctrl+O shortcut equivalent in IntelliJ IDEA?

– sachinjain024 – 2014-12-03T06:07:13.447

It is similar, but it is not exactly the same function. (?) – Felipe – 2014-12-03T18:29:55.247

2For me it is Alt-Cmd-O, Select Navigate->Symbol menu item. Next to it you can see your shortcut. – n0rm1e – 2016-05-31T07:23:56.900

Answers

242

Press SHIFT TWO times and you can search anything, both class and method in the project.

Vikas Gupta

Posted 2010-09-20T18:31:10.367

Reputation: 6 276

118If you type "sudo grep something /" you can also find anything, on your whole computer :) – olafure – 2015-03-02T16:55:54.327

8@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. – Vikas Gupta – 2015-03-03T17:35:32.593

39I 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. – Josh Gagnon – 2015-03-18T15:14:27.937

15not what OP was asking – FRR – 2015-04-24T12:59:42.440

10While 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... – dudewad – 2015-12-30T17:53:27.233

Does not work on Intellij 15.x version for methods (brings lot of clutter but methods) - also it makes sense to use a direct method navigation search for code that is familiar. You can directly jump to a known method name. I think the answer below is better choice. – software.wikipedia – 2016-02-23T03:50:58.533

1what is difference between this and Ctrl+Alt+Shift+N ? – Mahesha999 – 2016-08-30T14:22:11.293

while this is correct, double shift is terrible at finding method names. It also finds classes and filenames and probably coins under your seat as well. – Alex – 2017-06-20T14:20:09.653

Also press it FOUR times to include non-project related items. – Johnny Baloney – 2018-04-20T11:06:47.727

657

ctrl + F12 (cmd + F12 on macOS) will show all members of the current class in a popup windown and let you pick up one. It works exactly like the ctrl + o shortcut in eclipse, much faster than ctrl + alt + shift + n

Daniel Deng

Posted 2010-09-20T18:31:10.367

Reputation: 6 571

now I use mac. Do you know the equivalent shortcut for mac? Thanks! – Felipe – 2012-08-07T21:42:33.643

57Cmnd f12 on mac. I think this is a better answer. – TJ Seabrooks – 2012-08-09T13:41:33.900

8Cmnd + ALT + O is also very useful on macs, to find symbols. – Felipe – 2013-07-26T20:06:02.537

hmmm. Cmd+Alt+O actually leads me to optimize imports. Cmd+alt+shift+n does it though..maybe it depends on the version, I'm on 12.1.4 – Siddhartha – 2013-09-11T20:13:09.987

@Siddhartha, you need to change your config to fit Mac-style shortcuts. But everything changes. – Felipe – 2013-09-23T22:18:58.680

2What's the name of action to show all members of the current class? – sealskej – 2014-05-22T10:18:40.070

Hey, I can't figure something out: i.e. if I do Ctrl + F12 inside an Activity that extends another Activity and I want to look for OnCreate I only see the onCreate of the extended class why is that ? is there a simple way to lookup for methods just inside the class ? why they don't appear in th dialog ? – EviatarS – 2014-07-08T10:55:52.853

1In fact in Eclipse this is Ctrl+O (Quick Outline). Ctrl+Shift+O is for Organize imports. – Guillaume Husta – 2014-08-08T10:04:17.840

This is what I was looking for – blackbird014 – 2015-10-29T10:04:10.100

1This is awesome because I was only finding answers for searching across the whole project, which is a waste of time when you're searching for a method like "init" or "destroy". Thank you!! – dudewad – 2015-12-30T17:52:03.283

Works on Intellij 15.x version for me. This should be the right answer. – software.wikipedia – 2016-02-23T03:49:26.297

6@sealskej it's called "File Structure" on the keymap setting. – shanwu – 2016-11-20T12:50:35.077

1Please include the name of the action in the answer for people with different hotkeys – Mark – 2018-07-01T18:14:33.143

98

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.)

Brian Agnew

Posted 2010-09-20T18:31:10.367

Reputation: 225 444

Thank you very much! And how can I find this option on menus? – Felipe – 2010-09-20T18:38:23.873

I found it! It is under Go To menu. Easy! – Felipe – 2010-09-20T18:55:16.800

1Does not work for me on mac. Although CMD+ F12 works. Thanks – Ajak6 – 2016-08-29T19:59:34.993

Ctrl + F12 worked nice for me. Intelli IDEA J 2018.2 – minhas23 – 2018-10-31T08:41:02.830

14

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.

Joshua Pinter

Posted 2010-09-20T18:31:10.367

Reputation: 23 543

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). – hBrent – 2016-01-14T19:24:26.093

For complete clarity, what exactly is the definition of "Symbol" in terms of Android Studio? – Pinkerton – 2017-05-16T19:38:37.167

@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. – Joshua Pinter – 2017-05-17T00:12:59.717

7

CTRL + F12 brings up the File Structure navigation menu, which lets you search for members of the currently open file.

csvan

Posted 2010-09-20T18:31:10.367

Reputation: 3 436

6

IntelliJ IDEA Version 12.13 Ultimate Edition:

Macs: command + option + shift + N or on Menu -> Navigate > Symbol ...

Jack Chi

Posted 2010-09-20T18:31:10.367

Reputation: 336

2Did not work for me this option. Here in Mac is command + option + O – Felipe – 2013-06-04T19:53:53.920

1It depends on the keymap you choose in "Preference->Keymap" . it seems you choose the "Mac OS X 10.5+" – user674158 – 2014-04-13T09:43:31.073

5

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)

Geert

Posted 2010-09-20T18:31:10.367

Reputation: 1 420

5

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

nmfzone

Posted 2010-09-20T18:31:10.367

Reputation: 573

4

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)

Alex Richard

Posted 2010-09-20T18:31:10.367

Reputation: 79

1

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.

Kein

Posted 2010-09-20T18:31:10.367

Reputation: 512

1

To Find the actions build in the IDEA(reindent, create new, ...) you can use

CRTL+SHIFT+A

then type indent for example and ENTER.

T04435

Posted 2010-09-20T18:31:10.367

Reputation: 1 700

1

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.

user4617883

Posted 2010-09-20T18:31:10.367

Reputation: 321

0

Intellij v 13.1.4, OSX

The Open Symbol keyboard shortcut is command+shift+s

user1195796

Posted 2010-09-20T18:31:10.367

Reputation: 21

0

Ctrl + Shift + Alt+ 7 after selecting the method

Jahongir Rahmonov

Posted 2010-09-20T18:31:10.367

Reputation: 5 512

0

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.

Muhammad Hewedy

Posted 2010-09-20T18:31:10.367

Reputation: 11 137