Top 5 most useful keyboard shortcuts in IntelliJ IDEA

Paulina Szklarska
Code Well Mobile
Published in
4 min readJan 25, 2021

--

Photo by Aleksandra Wantuch on Unsplash

Hi! Today I’d like to share my favourites keyboard shortcuts I can’t imagine living without.

A few years ago I wrote two articles about keyboard shortcuts in Android Studio. They can be also applied to IntelliJ IDEA, so if you don’t know them, give it a reading!

Today, I’d like to share those who might be more obvious, but for those of you who don’t know them —I’m sure they’ll save you plenty of time and mouse clicking! Let’s start!

#1 Go to declaration

That’s my №1 shortcut, my all-time-favourite! With this shortcut, you can easily find all places where a class is declared. Super helpful when you want to check what are the occurrences of a specific class.

Tap on a name and go to a declaration with a shortcut

Just tap on a class name and use the shortcut:

macOS: Cmd + B

windows: Ctrl + B

More info: IntelliJ IDEA — Go to declaration and its type

#2 Find a class by name

Another very frequently used by me shortcut is for finding a class by its name. It’s very handy either when you’re looking for a specific class, or if you don’t remember the exact name or location, but just want to look through all the places.

With “All Places” option enabled, this will work both for classes in your code, as those from SDK as well.

Open Search dialog and look for a class

To open this “Search” dialog, simply run:

macOS: Cmd + O

windows: Ctrl + N

Note: You can navigate with Tab through “All”, “Classes”, “Files”, etc. tabs to look also in other places!

More info: IntelliJ IDEA — Searching everywhere

#3 Find action

This one runs in the same dialog as “Find a class by name”, but it’s so handy it requires a separate mention!

This shortcut is great when you want to use any of those actions, but… you haven’t remembered all those keyboard shortcuts yet. With one simple shortcut, you can access all of them!

Find any action if you don’t remember the shortcut

macOS: Cmd + Shift + A

windows: Ctrl + Shift + A

More info: IntelliJ IDEA — Search for actions

#4 Reformat code

With many languages, there comes a strict guideline of how each file should look like. It’s very important to keep the same code style across all the files in a project because it makes ours and other developers’ life easier when they have to read that in the future. To ensure the same code style you can run code reformatting.

Before reformatting (on the left) & after (on the right)

macOS: Cmd + Option + L

windows: Ctrl + Alt + L

More info: IntelliJ IDEA — Reformat and rearrange code

#5 Rename

The last, but not the least is a shortcut for renaming fields. IntelliJ IDEA has a very wide range of refactoring options, and that’s the one that I use probably 20 times a day. This refactoring option can be applied to everything — a class, method, field or variable name.

Rename any class, method, field or variable name

macOS: Shift + F6

windows: Shift + F6

More info: IntelliJ IDEA — Rename refactorings

That’s it for today! Thanks for reading, I hope you’ll try one or two of these shortcuts in your projects soon. Let me know in the comments if you use them already or if you know any other interesting ones! Stay tuned for more ✌️

--

--

Paulina Szklarska
Code Well Mobile

Flutter GDE / Flutter & Android Developer / blogger / speaker / cat owner / travel enthusiast