IDEA Basic Setup
Common IntelliJ IDEA plugins, shortcuts, Live Templates, and how to import and export your settings.
On this page
I'm going through Java systematically (mainly backend and Android), so I can't avoid IDEA, the IDE that gets the highest praise in the industry.
I hadn't really used any JetBrains tools before writing this. Mostly I ran things in VS Code with the CodeRun plugin. But VS Code struggles with large projects, especially Java projects. I'll be using GoLand, PyCharm and others later on, so it's worth writing down the basic JetBrains operations.
PS: I've installed most JetBrains products on my local computer. The account I bought on Taobao last year on January 13 for activation has gone a whole year without much use 😂
Here is my config file. I'll explain how to import and export the config at the end.
#Plugins
#Theme and Icons
Atom Material Icons sets file icons
Material Theme UI sets the theme (I usually use the Atom One Dark Theme)
Rainbow Brackets colors matching brackets
Honestly, IDEA has a lot of useful features built in, such as TODO and Git. Compared with VS Code plugins, some of these are even better in IDEA. (Anyone who has used its Git support says so.) I'll add other plugins only when I need them.
#Shortcuts
IntelliJ IDEA common shortcuts (Zhihu)
#Ctrl
Ctrl+D Duplicate the current line, or duplicate the selection and insert it below the cursor
Ctrl+W Extend selection step by step. It selects the word or paragraph under the cursor, and each extra press expands the selection further
Ctrl+E Show the list of recently opened files
Ctrl+N Find a class file by typing its name
Ctrl+G Jump to a specific line in the current file
Ctrl+F12 Show the structure of the current file in a popup. You can type directly in it to filter
Ctrl+Left Click Click the title of an open file to show its file path
#Alt
Alt+1,2,3…9 Show the tool window with that number. 1 is Project, the one I use most (essential)
Alt+Enter Show quick-fix options for the problem under the cursor. The results differ depending on where the cursor is
Alt+Insert Auto-generate code, such as getters and setters, constructors, toString(), and so on
Alt+Left Arrow Switch between subviews of the current tool window. For example, the Debug window has Output, Debugger and other subviews, and this shortcut switches between them
Alt+Right Arrow Switch between subviews of the current tool window, the same as above in the other direction
Alt+Up Arrow Jump the cursor to the previous method name in the current file
Alt+Down Arrow Jump the cursor to the next method name in the current file
#Ctrl + Alt
Ctrl+Alt+L Format code. Works on the current file or an entire package directory
Ctrl+Alt+T Wrap the selected code in a block such as if, try, or while
Ctrl+Alt+O Optimize imports. Works on the current file or an entire package directory
Ctrl+Alt+V Quickly introduce a variable
Ctrl+Alt+S Open IntelliJ IDEA's system settings
Ctrl+Alt+Enter Insert a blank line above the current line and move the cursor to it
Ctrl+Alt+Left Arrow Go back to where the previous action happened
Ctrl+Alt+Right Arrow Go forward to the place of the next action
Ctrl+Alt+Up Arrow In find mode, jump to the previous file with matches
Ctrl+Alt+Down Arrow In find mode, jump to the next file with matches
#Ctrl + Shift
Ctrl+Shift+Z Redo (undo the undo)
Ctrl+Shift+W Shrink selection step by step. It removes the selection around the word or paragraph under the cursor, and each extra press shrinks it further
Ctrl+Shift+T Create a unit test class for the current class, or choose an existing one if there already is one
Ctrl+Shift+C Copy the file's path on disk to the clipboard
Ctrl+Shift+V Open the popup of recently copied content
Ctrl+Shift+E Show the popup listing recently edited files
Ctrl+Shift+A Find actions and settings
Ctrl+Shift+/ Block comment
Ctrl+Shift+[ Select from the cursor to the opening bracket at the top
Ctrl+Shift+] Select from the cursor to the closing bracket at the bottom
Ctrl+Shift++ Expand all code
Ctrl+Shift+- Collapse all code
F3 Select the next word
Ctrl+Shift+F7 Highlight all occurrences of the selected text. Press Esc to clear the highlights
Ctrl+Shift+Space Smart code completion
Ctrl+Shift+Enter Complete the statement automatically, adding a semicolon at the end of the line
Ctrl+Shift+Backspace Go back to the place of the last edit
Ctrl+Shift+Left Click Put the cursor on a class variable and press this to jump straight to its definition in that class
Ctrl+Shift+Left Arrow In a code file, move the cursor to the start of the current word or Chinese phrase on the left, and select it
Ctrl+Shift+Right Arrow In a code file, move the cursor to the start of the current word or Chinese phrase on the right, and select it
Ctrl+Shift+Up Arrow Put the cursor on a method name and move the method above the previous one, to reorder methods
Ctrl+Shift+Down Arrow Put the cursor on a method name and move the method below the next one, to reorder methods
#Alt + Shift
Alt+Shift+Up Arrow Move the current line up
Alt+Shift+Down Arrow Move the current line down
#Debugging
Shift+F9 Run in debug mode
F7 Step into. If the current line with a breakpoint is a method call, enter the method body
F8 Step over. If the current line with a breakpoint is a method call, don't enter the method body
Shift+F8 Step out of the method body you stepped into
F9 Resume the program. If there's another breakpoint further down, it stops at the next one
#Customization
In VS Code, I usually set up arrow keys, like this:
- Shift+Alt+J Move cursor left
- Shift+Alt+K Move cursor down
- Shift+Alt+L Move cursor right
- Shift+Alt+I Move cursor up
- Shift+Alt+; Move cursor to the end of the line, the same as the End key
- Shift+Alt+H Move cursor to the start of the line, the same as the Home key
I set up the same thing in IDEA too.
In settings, find Keymap, then search for the keywords up, down, left, right, home and end, and assign a shortcut to each one. If a shortcut conflicts with an existing one, a prompt asks whether to REMOVE or LEAVE it. Choose REMOVE. These are low-value function keys that can be safely overwritten. If you mind, you can skip this.
Here are a few more shortcuts that I changed to match VS Code:
- Rename
rename Shift+F6⇒F2 - Redo
Ctrl + Shift + Z⇒Ctrl + Y - Open terminal
Alt + F12⇒ Ctrl + ` (based on how often I use the terminal)
If you're used to VS Code shortcuts, you can also install the VSCode Keymap plugin to map IDEA's shortcuts to the VS Code ones. That lowers the cost of switching.
#Other Operations
#Generating Code Quickly
Complete common code by typing an abbreviation or a suffix. Usually, you press Tab or Enter after typing it. Here are some of the most common:
| Code | Result |
|---|---|
| psvm | Generates a main method |
| .var | Automatically declares a variable for an expression |
| sout / .sout | Output: System.out.println() |
| .if | Generates an if statement |
| .for | Generates a loop, the enhanced for loop by default |
| .try | Generates a try … catch |
You can find the matching templates for each language in Settings ⇒ Editor ⇒ Live Templates, and you can also create your own.

#Changing the Maven Dependency Repository Location
Maven normally stores downloaded dependencies in C:\User{user}.m2\repository. You can move them somewhere else using the setting shown below.

#Importing and Exporting Settings
Follow the steps below and import or export whatever you need.

Export

Import
