General IntelliJ IDEA Tips & Tricks

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

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.

Search Everywhere

Recent Files

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.

Recent Files

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.

Recent Files

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.

Navigate to Implementation

Find Usages

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.

Find Usages

Create Test

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.

Navigate to Test

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.

See also:

image description