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 ReferenceTo 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

  1. Any file or folder list or panel can be searched or filtered by typing directly
  2. Arrow keys are supported at any location
  3. Favorites are a handy way to bookmark important files for easy retrieval
  4. Any dialog box or window can pass throughescexit
  5. Any navigation window can be passed throughshift + escShut down
  6. Any TAB is supportedalt + </>(Alt + arrow keys left/Arrow keys right) to switch
  7. For packages can passenterExpand or close
  8. Any shortcut instructions or commands you see will go throughCommand line execution
  9. Alt + left mouse buttonMultiple line operations can be performed
  10. For search, press the corresponding shortcut key continuously to switch to the search source
  11. alt + enterRegular 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 + F12To 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 findArrayListaddMethods:

In addition to supporting Java files (classes, enumerations, annotations, interfaces, etc.), it also works on some other files, such as.xmlFiles,.ymlFiles, 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.

ArrayListAs 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:

  • throughCtrl/Command + 2You can open the Favorites panel.
  • throughCtrl/Command + 4You can openRunPanel.

You can close the corresponding panel by repeatedly pressing the corresponding shortcut key. If the panel has a minus icon, you can still passShift + escTo shut down:Of course, some panels aren’t numbered, likeDataBase,Maven,TerminalAnd 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:

  1. Easy to remember. Some shortcuts don’t mean anything.
  2. 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 + ATo do:

  1. To open the Terminal screen, enterterminalCan.
  2. To open the Database screen, just typeDatabaseCan.
  3. To go to the Settings page, just typesettingsCan.
  4. To go to the plug-in management page, just typepluginsCan.
  5. Want to get intoProject Structure, just inputProject StructureCan.
  6. To format the code, just typeReformat CodeCan.
  7. To generate constructors, getters/setters, etc., all you need is inputGenerateCan.
  8. To see the parent class of this class, just typeGo to Super Class
  9. To rename the file, just typeRename FileCan.

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: