Top 5 Navigation Keyboard Shortcuts in IntelliJ IDEA Shortcuts
This post shows you five shortcuts that help you to navigate around IntelliJ IDEA quickly and efficiently.
This blog post covers the same material as the video. This provides an easy way for people to skim the content quickly if they prefer reading to watching, and to give the reader/watcher code samples and links to additional information.
The shortcuts covered in this post are:
- Search Everywhere – ⇧⇧ on macOS, or Shift+Shift on Windows/Linux
- Recent Files – ⌘E on macOS, or Ctrl+E on Windows/Linux
- Navigate to Implementation – ⌥⌘B on macOS, or Ctrl+Alt+B on Windows/Linux
- Find Usages – ⌥F7 on macOS, or Alt+F7 on Windows/Linux
- Create Test – ⌘⇧T on macOS, or Ctrl+Shift+T on Windows/Linux
Search Everywhere is very powerful and is useful for both experienced users and new users to IntelliJ IDEA. Search everywhere helps you find exactly what you need quickly, even if you don’t know the keyboard shortcut for it.
You can use Search Everywhere anywhere inside IntelliJ IDEA by pressing ⇧⇧ on macOS, or Shift+Shift on Windows/Linux to bring up the Search Everywhere dialog. It searches across Classes, Files, Symbols and Actions. Pressing the same shortcut again toggles the checkbox toggles the contextual check box in the top right corner.
You can type in what you want to search for, for example, Navigate. Search Everywhere also supports filtering commands like (forward slash) plugins or (forward slash) editor (show line numbers). You can toggle IntelliJ IDEA functionality on, or off, from this dialog.
You can view the Recent Files dialog at any time by using ⌘E on macOS, or Ctrl+E on Windows and Linux to display the Recent Files dialog. You can navigate around this dialog with the arrow keys and use the same shortcut again to filter the list to changed files only.
As with any IntelliJ IDEA dialog, you can type your search directly in to filter the results, for example, JavaAt25. You can also use Recent Files to display windows that don’t have keyboard shortcuts associated with them, for example, Maven.
Alongside Recent Files, we can also use ⌘⇧E on macOS, or Ctrl+Shift+E on Windows and Linux to bring up the Recent Locations dialog. Again, you can navigate around this dialog and type your search query straight in.
Navigate to Implementation
Navigate to Implementation can be used for both classes and methods and is very useful when you have multiple implementations. It answers the question ‘what do I do’?.
In our CustomerRepository interface the gutter icons show us that these methods are implemented elsewhere. We can use ⌥⌘B on macOS, or Ctrl+Alt+B on Windows and Linux to navigate to one of four implementations. If there is only one implementation, IntelliJ IDEA will take you straight there without the additional prompt.
Find Usages can also be used for both classes and methods and takes the opposite approach to Navigate to Declaration. It looks for where a specific implementation is used. It answers the question ‘what called me’?
We can use use ⌥F7 on macOS, or Alt+F7 on Windows and Linux to find the usages for our isEmployed method. We can see that there are two usages including the one we’re currently investigating. If we select the other usage, IntelliJ IDEA will take us to the location within the class.
Creating tests and adding to existing test classes is a very common requirement. Using our BananaCheck class, we can place the caret on the class name and use ⌘⇧T on macOS or Ctrl+Shift+T on Windows /Linux to generate a test class. IntelliJ IDEA gives us the option of generating helper code for the methods that we want to add tests for.
Now we can now go ahead and write our tests. We can use the same shortcut again to navigate back to our class as required.
There’s lots more that you can do with keyboard shortcuts in IntelliJ IDEA, but these are our top 5 navigation shortcuts that will help you to move around your project quickly and efficiently.
- Editor Tips & Tricks
- Top 15 IntelliJ IDEA Shortcuts Blog
- Navigation in IntelliJ IDEA (video) – even more tips
Subscribe to Blog updates
The New Terminal (Beta) Is Now in JetBrains IDEs
The new terminal (Beta) is now in JetBrains IDEs and will be available in the new UI starting from the 2024.1 version of the IDEs.
‘HelloWorld’ and ‘main()’ meet minimalistic
In this blog post, I'll cover why and how this feature is helpful for students using hands-on coding examples. I’ll also cover some details and frequently asked questions relevant to educators or experienced programmers. Let's get started. Hi Students - Your HelloWorld code is changing …
Easy Hacks: How To Implement Polymorphism in Java
Polymorphism is the ability of an object to take on different forms. In programming, this means that a variable or a method can have different behaviors depending on the type of object it represents. While the term may sound intimidating to beginners, polymorphism is a powerful tool: it helps you re…
Constructor Makeover in Java 22
Typically, we create alternative solutions for tasks that are necessary, but not officially permitted. For instance, executing statements before super() in a derived class constructor was not officially allowed, even though it was important for, say, validating values being passed to the base class …