Get shortcut key references and tips
If you are new to IntelliJ IDEA, you are recommended to download it Key Promoter X When you perform certain operations (if the operation has a corresponding shortcut key), a card will pop up at the bottom right of IntelliJ IDEA, telling you what the corresponding shortcut key is, as shown below:Of course, you can also use the menu barhelp -> keymap Reference
To get a list of IltelliJ IDEA completion shortcuts:
The IntelliJ IDEA hotkey reference translation is listed below, as follows:
The editor
- CTRL + space code completion (class, method, variable, etc.)
- CTRL + Shift + space intelligent code completion
- CTRL + Shift + Enter Complete code completion (format code, jump to the next line, complete code such as parentheses ‘(‘ curly braces ‘}’)
- CTRL + P to view the method parameters, in the call method parameters
- CTRL + Q view method comments/documentation
- Shift + F1 external file
- CTRL + Hover View brief information (class, method, parameter…)
- CTRL + F1 displays syntax error warning (hover over the mouse too much)
- Alt + insert generates code (constructor, getter/setter, hashCode/equals/toString)
- CTRL + O override method
- CTRL + I implementation method
- CTRL + Alt + T code surround (if… Else, try-catch, for, synchronized, etc….)
- CTRL + / single line comment and uncomment
- CTRL + Shift + / Multi-line (block) comment and uncomment
- CTRL + W selects the word (variable, method name, class…)
- CTRL + shfit + W Deselect or roll back the previous state
- Alt + Q: Content information
- Alt + Enter: Show IDEA quick fix (import class, add parentheses….)
- CTRL + Alt + L: Format code
- CTRL + Alt + O (Quick import)
- CTRL + Alt + I automatically indents horizontal lines (use CTRL + Alt + L) instead
- TAB/Shift + TAB indent/roll back current row indent
- CTRL + X cuts the current line
- CTRL + C copies the current line
- CTRL + V paste
- ctrl + shift + v
- CTRL + D copies the current line or selected block to the next line
- CTRL + Y deletes rows
- CTRL + Shift + J adds the next line to the end of the current line
- CTRL + Enter separates the current line
- Shift + Enter to start a new line
- CTRL + Shift + U Select the content to switch case
- CTRL + sfhit]/[Jump to start or end of code block
- CTRL + Delete/Backspace Deletes words or ends (use CTRL + left and right arrows +backspace or CTRL + W +backspace)
- CTRL + +/- Expands or collapses a code block
- CTRL + + expands the code block
- CTRL + – Collapses the code block
- CTRL + F4 closes the current active window or TAB
search
Alt + f7/ CTRL + f7 to find references
CTRL + shfit + F7 highlight to find references
CTRL + Alt + F7 Global search reference, list display
navigation
CTRL + N Lookup class (default is current item, use CTRL + N to switch lookup source)
CTRL + Shift + N Find file (default is current project, use CTRL + Shift + N to switch search source)
CTRL + Alt + Shift + N find references (search keywords can be variable names, method names)
Alt + left and right arrows toggle the file TAB
F12 rewinds to previous window
Esc closes the active window (any window can be closed by ESC)
CTRL + Shift + ESC Hide active window or last active window (conflicts with Windows shortcut keys)
CTRL + Shift + F4 Close the current Run window/Message window/Find window, etc
CTRL + G jumps to the specified line
CTRL + E opens the list of recently edited files
CTRL + Alt + Navigation rollback
CTRL + Shift + Backspace navigate to the last edit location
Alt + f1 opens the navigation window list
CTRL + B/CTRL + left mouse button go to definition (method definition, class definition, variable definition…)
CTRL + Alt + B go to Implementation (Implementation of abstract methods)
CTRL + Shift + I popover opens the definition
CTRL + Shift + B go to type definition
CTRL + U goes to the superclass method or superclass
Alt + arrow keys to jump up or down to the previous and next methods
CTRL + [/] moves to the beginning or end of the code block
CTRL + F12 popup opens the file structure
Shift + ESC closes the navigation window
CTRL + Shift + H method hierarchy
CTRL + Alt + H method call hierarchy
F2 / Shift + F2 jumps to the previous/next error position
F4 / CTRL + Enter Edit source/source definition
Alt + Home displays the navigation bar
F11 Toggle bookmarks
CTRL + F11 toggle bookmarks with tags
CTRL + Bookmark definition symbol jump to book signature
CTRL + [0-9] Jumps to the line with the label number
Shift + F11 popup opens the class that contains the label
Search and replace
Press Shift twice in a row to search the window
CTRL + F content search
F3 / Shift + F3 finds the previous or the next one
CTRL + R to replace
CTRL + Shift + F Find from items similar to (CTRL + Alt + Shift + N) more powerful search, full text search
CTRL + Shift + R replaces the entire project reference
Real-time template
CTRL + Alt + J template around the outside
CTRL + J inserts the live template
public static void main(String[] args) {
// live template
// iter JDk1.5 iteration style
for (String arg : args) {
}
// inst uses instanceof and checks object types
if (args instanceof Object) {
Object o = (Object) args;
}
// itco iterates over the java.util.collection element
for (Iterator iterator = collection.iterator(); iterator.hasNext(); ) {
Object next = iterator.next();
}
// ITIt iterates over java.util.Iterator elements
while (iterator.hasNext()) {
Object next = iterator.next();
}
// itli iterates over the java.util.List element
for (int i = 0; i < list.size(); i++) {
Object o = list.get(i);
}
// psf public static final
// thr throw new
}
Copy the code
refactoring
F5 Copy a new file
F6 Moves a file
Alt + delete Deletes data safely
Shift + f6 Rename (class name, filename, variable name, method name, parameter name)
CTRL + F6 Change signature (method, etc.)
CTRL + Alt + N inline
CTRL + Alt + M extraction method
CTRL + Alt + V extract variables
CTRL + Alt + F Extracts the field
CTRL + Alt + C extracts the content
CTRL + Alt + P extracts parameters
debugging
Compile and run
CTRL + F9 marks projects (compile changes and dependencies)
CTRL + Shift F9 Compiles the selected file, package, or template
Shift + F10 Run or debug (Run)
CTRL + Shift + f10 Run context configuration information from the editor (run main method)
Version control
CTRL + K/CTRL + T Commit project to Version control/Update from version Control
Alt + Shift + C View update logs
Alt + backquote(‘) opens the version control action TAB
other
Alt + [0-9] opens the corresponding window
CTRL + S saves all
CTRL + Alt + Y synchronization
CTRL + Shift + F12 toggle the maximized editor
Alt + Shift + F add to favorites
Alt + Shift + I check the code style using the default profile
CTRL + backquote(‘) Toggle styles (View theme, code theme, key map, view mode)
CTRL + Alt + S opens the Settings window
CTRL + Alt + Shift + S opens the project Structure window
CTRL + Shift + A execute command (e.g. Java Class)
Java Class: Create a file in the current package rename file: rename a file View mode: display mode show in Explorer: open the file folder.....Copy the code
CTRL + TAB toggles between TAB and file Windows
Qi Yin skills
- Any file or folder list or panel can be searched or filtered by typing directly
- Arrow keys are supported at any location
- Favorites are a handy way to bookmark important files for easy retrieval
- Any dialog box or window can pass through
esc
exit - Any navigation window can be passed through
shift + esc
Shut down - Any TAB is supported
alt + </>
(Alt + arrow keys left/Arrow keys right) to switch - For packages can pass
enter
Expand or close - Any shortcut instructions or commands you see will go through
Command line execution
Alt + left mouse button
Multiple line operations can be performed- For search, press the corresponding shortcut key continuously to switch to the search source
alt + enter
Regular check and JSON check can be performed
Using file and open/close panels as examples, let’s look at the use of shortcut keys:
file
Find class files
You can use Command + O /Ctrl + O (letter O) to search for related classes. You only need to enter the keyword in the input box to search for the corresponding class. Note that the search scope matches the class file.
Find files
If you are looking for other files, such as the project configuration file application.yml, then you can do this by using Command + Shift + O /Ctrl + Shift + O:
View file structure
After opening a file (ArrayList) file as an example, you can view the structure of the file by pressing Ctrl/Command + 7:
Of course, you can passCtrl+F12/Command + F12
To see the structure of the file:
In the file structure (class/interface/enumeration/annotation file for example), you have properties, methods, and fields. You can change the shortcut key to quickly locate the corresponding property, method, and field. Simply open the panel and enter the keywords you want to match, such as findArrayList
的 add
Methods:
In addition to supporting Java files (classes, enumerations, annotations, interfaces, etc.), it also works on some other files, such as.xml
Files,.yml
Files, etc.
Look at the inheritance system of the class
Right-click Diagrams and select Show Diagram… You can view the inheritance system of the class.
以 ArrayList
As an example, the resulting effect is shown below:
Open/close the panel
You can open the corresponding panel by Ctrl/Command + 1-9. For example, Ctrl/Command + 1 can open Project, because there is a corresponding numeric marker in the corresponding panel:
The same goes for:
- through
Ctrl/Command + 2
You can open the Favorites panel. - through
Ctrl/Command + 4
You can openRun
Panel.
You can close the corresponding panel by repeatedly pressing the corresponding shortcut key. If the panel has a minus icon, you can still passShift + esc
To shut down:Of course, some panels aren’t numbered, likeDataBase
,Maven
,Terminal
And so on. We will explain later how to use commands/commands/actions to get to a shortcut key if you can’t remember it.
Ctrl/Command + Shift + A
If you can’t remember the shortcut keys, if you need to use IltelliJ IDEA on Mac/Linux/Windows and don’t want to remember the corresponding shortcut keys for each version, the recommended shortcut keys are Ctrl/Command + Shift + A. If each shortcut key corresponds to an action (option)/ action (action), conversely, an action (action)/ action can be used to perform the corresponding operation of the shortcut key, which brings the following benefits:
- Easy to remember. Some shortcuts don’t mean anything.
- Solve the problem of using IltelliJ IDEA on Mac/Linux/Windows.
Get/know what actions are available
Go to Settings -> Keymap and holdButton to find the action of the shortcut key. For example, on the Mac, the shortcut key for formatting codes is Option + Command + L, and the action corresponding to the shortcut key is Reformat code. Of course, when you want to do something, you just have to think of what you would name the action if you could name it, and try it out in find in Action.
To perform the action
Ctrl/Command + Shift + A to execute the action. For example, if the action for formatting Code is Reformat Code, press Ctrl/Command + Shift + A. Then enter Reformat Code in the input box to format the Code:
It is much easier to remember actions than keyboard shortcuts, and you can also pass some actions that do not support keyboard shortcuts by defaultCtrl/Command + Shift + A
To do:
- To open the Terminal screen, enter
terminal
Can. - To open the Database screen, just type
Database
Can. - To go to the Settings page, just type
settings
Can. - To go to the plug-in management page, just type
plugins
Can. - Want to get into
Project Structure
, just inputProject Structure
Can. - To format the code, just type
Reformat Code
Can. - To generate constructors, getters/setters, etc., all you need is input
Generate
Can. - To see the parent class of this class, just type
Go to Super Class
。 - To rename the file, just type
Rename File
Can.
Of course, action supports fuzzy search, such as Go to Super Class, you can just type Super to match.
Change shortcut keys
Select Settings -> Keymap to open the corresponding panel, enter Aciton to search, or hold down search icon and enter the corresponding shortcut key to search. After retrieving the item to be modified, click the third button to make the corresponding modification: