JetBrains
At least 50% off from FlexSub
Subscribe Now
Despite the fact that there are numerous excellent alternatives, the Jetbrains editor family has a large following. Intellij IDEA, Android Studio, PyCharm, WebStorm, PhpStorm, CLion, GoLand, Rider, and other IDEs are based on the Jetbrains IntelliJ platform.
It is beneficial to learn the most important shortcuts in these editors, and I believe that these seven are the most important. They will save you a significant amount of time!
1. Select increasing / decreasing sections of code
Windows, Linux: Ctrl + W / Shift + Ctrl + W
Mac: ⌥ + ↑ and ⌥ + ↓
You can select increasing or decreasing sections of code near the cursor by pressing Ctrl + W or Ctrl + Shift + W respectively. The editor will smartly detect the bounds of a selection that is useful. This one is super useful when you need to indent or delete an entire section of code.
2. Apply a fix or correction
All platforms: Alt + Enter
If you only learn one shortcut, it must be Alt + Enter. It shows suggestions to fix a problem. You can select one of the fixes with the arrow keys and hit enter to apply it directly.
As an extra speedy option, shift +Alt + Enter applies the first suggestion. Since IntelliJ will order the suggested fixes by most likely applicability, this is often enough!
3. Go to the next error, warning, or suggestion
All platforms: F2
With this key, you’ll go to the next error, warning, or suggestion. This one works nicely in combination with Alt
+ Enter
. Use it to navigate inside the current file and fix all problems, one by one.
4. Go to the declaration
Windows, Linux: Ctrl+B
MacOS: ⌘B
To go to the declaration of a symbol, press Ctrl + B. For example, pressing this on a variable will take the cursor to the variable declaration. Using it on a class name will open a new tab and take you to the class file. With ⌥ + ⌘ + B (MacOS) or Ctrl+Alt+B (Windows/Linux), you can navigate to an implementation too.
5. Open project window
Windows, Linux: Alt+1
MacOS: ⌘ + 1
How often do you use your mouse to navigate your project inside the project window on the left? I bet it’s a lot.
With Alt + 1, you can open the project window and put the focus in there too. You can navigate the project tree using your arrow keys, and search by simply starting to type what you’re looking for. When you’re done, use ESC to go back to the editor.
6. Put the focus back to editor / Cancel changes
All platforms: ESC
This one works nicely in combination with other shortcuts, like Alt + 1 from above. It put the focus back to the editor, no matter what tool window is open. In addition, the escape key allows you to close any popup without applying changes.
7. Comment out a line or selection of code
Windows, Linux: Ctrl + /
MacOS: ⌘ + /
If you want to temporarily comment out a section of code, you can do so by first selecting the section (remember to use Ctrl + W / Shift + Ctrl + W) and then hitting Ctrl + /.
If you want to comment out the current line of code, simply hit Ctrl + / too — no selection needed.
JetBrains
At least 50% off from FlexSub
Better, flexible and cheaper subscriptions for a wide range of services in just a click of a button.
Get started now