intellij-ideakeyboard-shortcutsideavim

How to quickly jump to the class declaration line in IntelliJ?


Suppose a Foo.java file which defines the Foo class.

The cursor is now on some line of Foo.java. The symbol under the cursor is not necessarily Foo).

How to quickly jump to the class declaration line (i.e., the line like public class Foo {) in Intellij?

Any shortcuts for this?


I use the ideavim plugin. Therefore, solutions relying on vim functionalities are OK.


Solution

  • On Mac you can do cmd + up arrow (on Windows or Linux, I'm assuming it will be ctrl + up arrow)

    This will select the current file in the breadcrumb (navigation bar) then hit enter and you'll be at the class declaration

    You can look to which key combination this is mapped for you by looking in the keymaps for 'Jump to Navigation Bar'

    Jump to Navigation Bar