Mastering IntelliJ IDEA Keyboard Shortcuts
Being heavily focused on ergonomics, IntelliJ IDEA has a keyboard shortcut for nearly every action, from working with code to managing UI, its various integrations and settings. Since IntelliJ IDEA is a professional IDE, the sheer number of these actions is really large, and learning all shortcuts that can be used to invoke them is sure a very difficult task. Let me give you some pointers to help with that.
Choose a right keymap
IntelliJ IDEA comes with fine tuned, ergonomically tested keymaps that we built based on years of experience and user feedback. It’s recommended that you select a keymap that matches OS you’re using.
If you already have a customized keymap, you can easily transfer it between different IntelliJ IDEA installations.
Make sure the chosen keymap doesn’t conflict with OS
Make a quick check to ensure key combinations in your keymap don’t conflict with OS and other globally defined shortcuts and make adjustments to resolve any conflicts before using IntelliJ IDEA.
Also, check the following based on the OS you’re using:
- Function keys F1 thru F12 are disabled BECAUSE WHAT?
- Show Spotlight Search Field is disabled, because it clashes with Ctrl+Space and Code Completion
- Use Mac OS X 10.5+ keymap, not Mac OS X
Ubuntu (disable all of the following):
- Shade Window, assigned to Ctrl+Alt+S, clashes with Settings
- Lock Screen, assigned to Ctrl+Alt+L, clashes with Reformat Code
- Launch Terminal, assigned to Ctrl+Alt+T, clashes with Surround With
- Switch to Workspace, assigned to Ctrl+Alt+Arrows, clashes with in-IDE navigation
- Move Window, assigned to Alt+F7, clashes with Find Usages
- Resize Window, assigned to Alt+F8, clashes with Evaluate Expression
- Virtual Consoles, assigned to Ctrl+Alt+F12, clashes with Commit
Use an English keyboard, if you can, or otherwise you’ll need to specifically make sure that keyboard shortcuts work properly.
Tune keymap to your preferences
If any of the default shortcuts is not right for you, simply change it via Settings | Keymap. You can search for actions either by name, or by shortcuts assigned to it.
Search for action by name
The shortcut you absolutely have to learn is Find Action. With it, you can find any action by a part of its name, examine its properties, and of course, invoke that action.
Note, Find Action also lets you manage IntelliJ IDEA settings and plugins.
Another way of exploring IntelliJ IDEA actions and learn shortcuts is perusing its main menu: there you can find semantically grouped actions and see shortcuts assigned to them.
Download and print keymap reference
Keymap Reference comes in a form of PDF document that you can print and use as a cheat sheet to quickly look up most popular shortcut combinations.
Install key promoter
Finally, install the Key Promoter X plugin that will help you learn shortcuts for any action that you have invoked with mouse.
It’s impossible to memorize all shortcuts you’re using. To make this easier, IntelliJ IDEA lets you group actions and form a Quick List (Settings | Appearance & Behavior | Quick Lists) which then can be invoked with a single shortcut.
IntelliJ IDEA comes with two very useful preconfigured quick-lists: Refactor This (Ctrl+Alt+Shift+T on Windows/Linux and Ctrl+T on macOS) and VCS Operations (Alt+` on Windows/Linux and Ctrl+V on macOS).
Tune smart keys
There are many keyboard-related settings in IntellIJ IDEA. One of them, Smart Keys (Settings | Editor | General | Smart Keys), is especially interesting because it lets you toggle automatic insertion of pair brackets, quotes, curly braces, and enable CamelHumps.
Use speed search
Keep in mind that Speed Search is provided in almost all of the parts of IntelliJ IDEA UI. When your focus is in a tree, list, or table, just start typing to see elements that match your input.
Press again for more results
Many of IntelliJ IDEA actions like Code Completion, Structure, Go to …, Rename provide more results after you call them twice.
Resize tool windows
IntelliJ IDEA even lets you resize tool windows with Ctrl+Shift+Arrows on Windows/Linux and Shift+Cmd+Arrows on macOS.
There is a number of IDE-independent shortcuts yet that come very handy when you work with IntelliJ IDEA:
- Maximize Window (Win+Up on Windows and Ctrl+Cmd+= on macOS)
- Next Project Window (Ctrl+Alt+J on Windows/Linux and Cmd+` on macOS), useful when you have multiple projects open at the same time
Open a project
When working with multiple projects, you can use another useful very helpful action: Manage Projects. Call it, and IntelliJ IDEA will offer you to open one of the recent projects.
Assign shortcuts to Maven and Gradle
In addition to actions, shortcuts can also be assigned to Maven goals and Gradle tasks through the, correspondingly, Maven and Gradle tool windows.
Install ideaVim plugin
Finally, if you are a dedicated Vim fan, and cannot go on coding in a different editor, get yourself a copy of IdeaVim plugin.
Hope you’ve found the blog post useful. Keep calm, and Alt+Enter!