1. Build/compile
Ctrl + F9
: build project
This shortcut key is equivalent to the menu【Build】—>【Build Project】
After executing this command, IntelliJ IDEA will compile all classes in the project and output the compilation results to out
the directory. IntelliJ IDEA supports incremental builds, and only compiles modified classes based on the last build.
Ctrl + Shift + F9
: recompile the current class
This shortcut key is equivalent to the menu【Build】—>【Recompile 'class name'】
Open the class to be compiled in IntelliJ IDEA, and execute this command to compile the current class.
2. Text editing
Ctrl + X
: cut
Cut the selected text, or cut the current line if it is not selected.
Ctrl + C
:copy
Copy the selected text, or copy the current line if it is not selected.
Ctrl + V
: Paste
Ctrl + Alt + Shift + V
: paste as plain text
Ctrl + Shift + V
: Select paste from history
Select content to paste from the history cut and paste.
Ctrl + D
: Copy row
Copy the line where the cursor is located.
Ctrl + Shift + C
: copy file path
Copy the path where the selected file is located.
Ctrl + Alt + Shift + C
: copy reference
Copy the path of the package, or the name of the class.
Ctrl + S
: save all
Ctrl + Z
: undo
Undo the content of the previous operation.
Ctrl + Shift + Z
: redo
Redo the undone content in the previous step.
Tab
:indentation
Shift + Tabl
: unindent
Ctrl + Alt + I
: auto-indent lines
Automatically indent to canonical position.
Shift + Enter
: start a new line
Start a new line regardless of whether the cursor is at the end of the line.
Ctrl + Alt + Enter
: start a new line before the current line
Ctrl + Y
: delete row
Delete the current line.
Ctrl + Shift + U
: case conversion
Ctrl + Alt + Shift + Insert
: Create a temporary file
Various types of temporary files can be created that are not saved to disk.
Shift + F4
: open in a new window
Open the current file in a new window.
3. Cursor operation
Ctrl + Left
: Move one word to the left
Ctrl + Right
: Move right one word
Home
: move to the beginning of the line
End
: move to the end of the line
Ctrl + Shift + M
: move to braces
Press the shortcut key multiple times to switch between the left and right braces.
Ctrl + [
: move to the beginning of the code block
Ctrl + ]
: move to the end of the code block
Alt + Down
: next method
Alt + Up
: previous method
Ctrl + PageUp
: move to the top of the page
Ctrl + PageDown
: move to the bottom of the page
PageUp
: page up
PageDown
: page down
Ctrl + Home
: move to the beginning of the file
Ctrl + End
: move to the end of the file
4. Text Selection
Ctrl + A
:select all
Shift + Left
: select left
Shift + Right
: select right
Ctrl + Shift + Left
: Select a word to the left
Ctrl + Shift + Right
: Select a word to the right
Shift + Home
: Select left to the beginning of the line
Shift + End
: Select right to the end of the line
Shift + Up
: select up
Shift + Down
: select down
Ctrl + Shift + [
: Select to the beginning of the code block
Ctrl + Shift + ]
: Select to the end of the code block
Ctrl + Shift + PageUp
: select to the top of the page
Ctrl + Shift + PageDown
: select to the bottom of the page
Shift + PageUp
: page up selection
Shift + PageDown
: Scroll down to select
Ctrl + Shift + Home
: select to file switch
Ctrl + Shift + End
: Select to the end of the file
Ctrl + W
: Extended selection
Ctrl + Shift + W
: shrink selection
5. Code folding
Ctrl + NumPad+
: expand the code block
Ctrl + NumPad-
: fold code block
Ctrl + Alt + NumPad+
: recursive expansion
Ctrl + Alt + NumPad-
: recursive fold
Ctrl + Shift + NumPad+
: expand all
Ctrl + Shift + NumPad-
: Collapse all
Ctrl + .
: Collapse selection
6. Multiple carets and range selection
Alt + Shift + Click
: add/remove caret
Alt + Shift + Insert
: toggle column selection mode
Double click Ctrl
+ Up
: Clone caret up
Press the keyCtrl
twice, then press the Up Arrow key without releasing it.
Double click Ctrl
+ Down
: Clone the caret down
Press the keyCtrl
twice, then press the Down Arrow key without releasing it.
Alt + Shift + G
: add the caret to each line in the selection
Alt + J
: Select the position where the unit will appear next
Alt + Shift + J
: Cancel the last selection
Ctrl + Alt + Shift + J
: select all occurrences
Alt + Shift + Middle-Click
: Create a rectangular selection
Alt + Click
: Drag to create a rectangular selection
Ctrl + Alt + Shift + Click
: Drag to create multiple rectangular selections
7. Auxiliary coding
Alt + Enter
: Show suggested actions
This shortcut key is also called "Wantong shortcut key", and it will suggest different operations according to different contexts. The demo below is just one of them, there are many usages, you can try it.