Mastering your IntelliJ IDEA: 5 Tricks to help with Navigation
An integrated development environment (IDE) is a tool developers use daily, so we should master it.
We usually use some shortcuts daily, like CTRL + C and CTRL + V, but we can also use many more, to do many things, like formatting the code, identifying errors, and also using the IDE to suggest solutions for these errors.
All the Keyboards shared here can be used with Windows & Linux, at the end of this article you can have a look at a cheat sheet with the reference for Mac, and also other shortcuts.
Let’s talk about 5 tricks that would help us navigate through our code easily.
1. Next / Previous highlighted error — F2/Shift + F2
When coding, it's easy to break things, and IDE suggestions can improve code quality and reduce bugs.
To take advantage of that, we can use the function of Next / Previous highlighted error, using F2 for Next and Shift + F2 for the Previous highlighted error.
You can combine this shortcut and also Alt + Enter to recommend the fixes, and it will help you to increase your productivity.
2. Go to line — Ctrl + G
Every so often when we are doing pair programming, or fixing some code review, we need to go directly to a specific line. We can, of course, scroll down or up, but there is a smart way.
We can use the shortcut Ctrl +G
3. Recent files popup — Ctrl + E
When you want to see the latest recent files, we don't need to interrupt your thinking to try to remember the file name.
You can use the shortcut Ctrl + E which will bring up your last opened files.
4. Navigate back / forward — Ctrl + Alt + Left/Right
This is one of the most useful hotkeys in my opinion. When we are coding, it is very common to go to many files, methods, or lines. Going back or forward can be a problem if we do not use hotkey.
Fortunately, IntelliJ provides a shortcut for it, you can use Ctrl + Alt + Left to go back and Ctrl + Alt + Right to go forward.
Tip: I do recommend you add these 2 shortcuts in your mouse in case you use it.
5. Go to file — Ctrl + Shift + N
Last, but not least. We usually need to find a file and the easiest way is to use the power of IntelliJ indexes to search files, and we can do that using the hotkey Ctrl + Shift + N.
As a bonus, you can also use the hokey Shift + Shift to search everywhere. This command searches everywhere, it not only searches the classes and files, but it also searches the commands and hotkeys from IntelliJ.
Conclusion
These are only a few shortcuts that can help a lot with our daily activities. I highly recommend you to use them. It can be hard in the beginning because you are not used to it, but the key is consistency.
I hope these shortcuts can help you, and if you know any other shortcuts that you like to use, share them here in the comments 😁😁
Access this cheat sheet to see most of the shortcuts you can use with IntelliJ: IntelliJ Shortcuts Cheat Sheet.