Handy shortcuts in IntelliJ IDEA

6 minute read Published: 2022-10-12

IntelliJ IDEA is my daily driver. Since I was introduced to Eclipse for Java at my university a while ago and experienced the terror, I was looking for alternatives and I found Intellij. I use it all the time, and it's definitely my favorite IDE. All the other Jetbrains products such as PyCharm and WebStorm are also on the same high standard.

In this short article I'm going to go through what kind of good commands you could use to maximize your development experience with the IDE to get more productive.

The search functionality is great in IntelliJ. To open up the quick search press: SHIFT + SHIFT and you will get up a popup like this.

IntelliJ IDEA Screenshot 0

Here you can enter in class name, file, method, field and much more and it will display it and you can move the arrows up and down and press enter to go to the location easily. You can also add / to see available commands such as searching for plugins with /plugins and move your cursor up and down and enable/disable. And also there is option to change the behaviour of your editor by enable/disable features.

IntelliJ IDEA Screenshot 1

There is a bunch of commands here so I won't cover all of them. But those are useful ones.

Search for everything in the project

IntelliJ IDEA Screenshot 2

Sometimes you want to search for strings or something inside a file to do that I usually use:

OS X
CMD + SHIFT + F

Windows
CTRL + SHIFT + F

Linux
CTRL + SHIFT + F

Go to implementation

Lets say that you are on your interface or anywhere in the source code that uses a method, but you want to go to that code to see how it works under the hood.

IntelliJ IDEA Screenshot 3

To do that you could simply put your cursor as in this example on the interface method name and press the following.

OS X
CMD + OPTION + b

Windows
CTRL + ALT + b

Linux
CTRL + ALT + b

This will take you to the actual code in DaemonBasic class that implements that method.

IntelliJ IDEA Screenshot 4

Go to declaration

To go to an actual usage of the method where it is declared you can do as you did before but this time press the following.

OS X
CMD + b

Windows
CTRL + b

Linux
CTRL + b

IntelliJ IDEA Screenshot 5

Go to last/previous cursor position

This is very nice feature, let's say you are standing like on the previous file and you want to go back where you were looking at before. You can simply press the following.

OS X
CMD + OPTION + LEFT

Windows
CTRL + ALT + LEFT

Linux
CTRL + ALT + LEFT

You change left with right arrow if you want to go forward.

Collapse/expand all code blocks

IntelliJ IDEA Screenshot 6

Sometimes I like to just collapse all the code blocks to get an overview. This can be done by pressing the following.

OS X
CMD + SHIFT (-)

Windows
CTRL + SHIFT (-)

Linux
CTRL + SHIFT (-)

To expand all code blocks again just change minus to plus.

Renaming

For some reason I have always been right clicking and selecting refactor > rename in IntelliJ, it's clearly displaying the shortcut there, but whatever. By the user named Ahmedouyahya he/she recommended me here in the comment section of the shortcut so I edited this article now and added this.

OS X
SHIFT + F6

Windows
SHIFT + F6

Linux
SHIFT + F6

IntelliJ IDEA Screenshot 1

Browse recent files

If you are like me I usually have multiple files open. Sometimes more than can fit the tab bar. So what I usually use is to browse recent files.

OS X
CMD + E

Windows
CTRL + E

Linux
CTRL + E

IntelliJ IDEA Screenshot 8

Summary

Every day I discover something new in IntelliJ IDEA that helps a lot for my productivity.

I hope this helped you and if you find these articles interesting, please follow me here for upcoming tutorials and consider follow me on my social medias below. I am thinking of doing a separate tutorial on how to use IntelliJ for debugging.

If you found it valuable, please consider sharing it, as it might also be valuable to others. Let me know if you have any questions by reaching me on 𝕏!

References

Connect with me