Tools | IntelliJ IDEA 2019 Ultimate Shortcuts

Reposted from: Interesting souls count me in http://uee.me/aXfNf

automatic code

Commonly used are fori/sout/psvm+Tab to generate boilerplate boilerplate code such as loops, System.out, and main methods.

For example, to enter for(User user : users), just enter user.for+Tab;

For another example, to enter Date birthday = user.getBirthday(), just enter user.getBirthday().var+Tab.

After the code label is entered, press Tab to generate the code.

  1. Ctrl+Alt+O optimize imported classes and packages

  2. Alt+Insert Generate code (such as get, set method, constructor, etc.) or right click (Generate)

  3. fori/sout/psvm + Tab

  4. Ctrl+Alt+T generate try catch or Alt+enter

  5. CTRL+ALT+T put the selected code in TRY{} IF{} ELSE{}

  6. Ctrl + O override method

  7. Ctrl + I implementation method

  8. Ctr+shift+U case conversion

  9. ALT+Enter import package, automatic correction

  10. ALT+/ code hint

  11. CTRL+J automatic code

  12. Ctrl+Shift+J, integrate two lines into one line

  13. CTRL+space code prompt

  14. CTRL+SHIFT+SPACE autocomplete code

  15. CTRL+ALT+L formatting code

  16. CTRL+ALT+I auto-indent

  17. CTRL+ALT+O optimize imported classes and packages

  18. ALT+INSERT generates code (such as GET, SET method, constructor, etc.)

  19. CTRL+E Last changed code

  20. CTRL+ALT+SPACE class name or interface name prompt

  21. CTRL+P method parameter prompt

  22. CTRL+Q, you can see the declaration of the current method

  23. Shift+F6 refactoring - renaming (packages, classes, methods, variables, even comments, etc.)

  24. Ctrl+Alt+V extract variable

Query shortcut key

  1. Ctrl+Shift+Backspace can jump to the last edited location

  2. CTRL+ALT+ left/right Navigate the edited place back and forth

  3. ALT+7 The left window displays the structure of the current file

  4. Ctrl+F12 floats to display the structure of the current file

  5. ALT+F7 Find all references to your function or variable or class

  6. CTRL+ALT+F7 Find all references to your function or variable or class

  7. Ctrl+Shift+Alt+N Find methods or variables in a class

  8. Double-click SHIFT to find files in all directories of the project

  9. Ctrl+N Find class

  10. Ctrl+Shift+N find files

  11. CTRL+G locate line

  12. CTRL+F Find text in the current window

  13. CTRL+SHIFT+F Find text in the specified window

  14. CTRL+R replace text in current window

  15. CTRL+SHIFT+R replace text in the specified window

  16. ALT+SHIFT+C Find modified files

  17. CTRL+E Recently opened files

  18. F3 Down to find the position where the keyword appears

  19. SHIFT+F3 Upward keyword occurrence position

  20. Select the text, press Alt+F3 to highlight the same text, F3 to find the same text one by one

  21. F4 find variable source

  22. CTRL+SHIFT+O popup display search content

  23. Ctrl+W to select the code, press continuously to have other effects

  24. F2 or Shift+F2 highlight errors or warnings for quick positioning

  25. Ctrl+Up/Down cursor jumps to the first or last line

  26. Ctrl+B Quickly open the class or method at the cursor

  27. CTRL+ALT+B find all subclasses

  28. CTRL+SHIFT+B Find the class of the variable

  29. Ctrl+Shift+up and down keys to move the code up and down

  30. Ctrl+Alt+ left/right Return to last browsed location

  31. Ctrl+X delete line

  32. Ctrl+D Duplicate line

  33. Ctrl+/ or Ctrl+Shift+/ Comment (// or /…/ )

  34. Ctrl+H to display the class structure diagram

  35. Ctrl+Q Display comment documentation

  36. Alt+F1 Find the location of the code

  37. Alt+1 Quickly open or hide the project panel

  38. Alt+ left/right switch code view

  39. ALT+ ↑/↓ Quickly move and locate between methods

  40. CTRL+ALT+ left/right Navigate the edited place back and forth

  41. Ctrl+Shift+Backspace can jump to the last edited location

  42. Alt+6 Find TODO

other shortcut keys

  1. SHIFT+ENTER starts a new line

  2. CTRL+Z rewind (undo)

  3. CTRL+SHIFT+Z forward (cancel undo)

  4. CTRL+ALT+F12 explorer opens folder

  5. ALT+F1 Find the directory where the file is located

  6. SHIFT+ALT+INSERT vertical editing mode

  7. CTRL+F4 close the current window

  8. Ctrl+Alt+V, you can introduce variables. For example: new String(); Automatically import variable definitions

  9. Ctrl+~, quick switching scheme (interface appearance, code style, shortcut key mapping and other menus)

Debug shortcut

In fact, the commonly used ones are F8, F7, and F9. The most worth mentioning is that Drop Frame can make the code that has been run start all over again.

  1. Select view value when alt+F8 debug

  2. Alt+Shift+F9, select Debug

  3. Alt+Shift+F10, select Run

  4. Ctrl+Shift+F9, compile

  5. Ctrl+Shift+F8, view breakpoints

  6. F7, step into

  7. Shift+F7, smart step into

  8. Alt+Shift+F7, force step into

  9. F8, step over

  10. Shift+F8, step out

  11. Alt+Shift+F8, force step over

  12. Alt+F9, run to the cursor

  13. Ctrl+Alt+F9, force to run to the cursor

  14. F9, restore program

  15. Alt+F10, navigate to the breakpoint

refactor

  1. Ctrl+Alt+Shift+T, pop-up refactoring menu

  2. Shift+F6, rename

  3. F6, move

  4. F5, copy

  5. Alt+Delete, safe delete

  6. Ctrl+Alt+N, inline

Top 10 Intellij IDEA Shortcut Keys

There are many shortcut keys in Intellij IDEA that make people love it, and there are some interesting discussions on stackoverflow. Everyone has their favorites, and it's hard to come up with an ideal list.

I have sorted out the shortcut keys of Intellij before. This time, according to the frequency of use in my daily development, I will briefly list my top ten favorite shortcut keys.

1. Smart Tips

The first thing Intellij bears the brunt of course is Intelligence intelligence! Basic code prompts use Ctrl+Space, and more intelligently prompt Ctrl+Shift+Space according to type information, but because Intellij always prompts automatically as we tap, so many times we will not type these two shortcuts manually key (unless the tooltip disappears).

Use F2/Shift+F2 to move to the wrong code, Alt+Enter to quickly fix it (that is, the Quick Fix function in Eclipse). When the smart prompt automatically completes the method name for us, we usually have to fill in the back brackets and semicolons at the end of the line. It will be troublesome when the brackets are nested in many layers. At this time, we only need to press Ctrl+Shift+Enter Autocomplete characters at the end. And not just brackets, for example, {} curly brackets can also be automatically added after typing if/for.

Finally, I want to say that Intellij can intelligently perceive the configuration files and classes of mainstream frameworks such as Spring and Hibernate, and use static braking to intelligently scan and understand how your project is structured and configured under the seemingly "static" appearance.

2. Refactoring

Intellij refactoring is another function that explodes Eclipse. Its intelligence is jaw-dropping. For example, when extracting variables, it automatically checks that all matches are extracted into one variable at the same time. Especially after reading "Refactoring - Improving Existing Code Design", the cooperation of Intellij is simply enjoyable! It is also the powerful intelligence and refactoring functions that make the TDD development under Intellij very smooth.

Cutting to the point, let's talk about an invincible refactoring function with a large summary shortcut key Ctrl+Shift+Alt+T, called Refactor This. The method is a bit complicated, but it also conforms to the style of Intellij. Many shortcut keys need to be completed with both hands, unlike many of the most useful shortcut keys in Eclipse, which can be completed with one hand (I don’t know if it is a major advantage of Eclipse). But if you have used Emacs, you will feel that it is nothing (not Emacs black).

In addition, there are some of the most commonly used refactoring techniques, because they are too commonly used, and it is a bit inefficient to choose in the Refactor This menu every time. For example, Shift+F6 is directly renamed, and Ctrl+Alt+V is to extract variables. Follow the WeChat official account of the Java technology stack, and reply to the keyword in the background: IDEA, you can get a copy of IDEA's latest technology dry goods organized by the stack leader.

3. Code Generation

This is similar to Eclipse. Although it is not unique, it is still listed at the top of the list because of its high frequency of daily use. Commonly used are fori/sout/psvm+Tab to generate boilerplate boilerplate boilerplate code such as loops, System.out, and main methods. Use Ctrl+J to view all templates.

Alt+Insert will be mentioned in the "Auxiliary" section later. Clicking in the editing window can generate constructors, toString, getter/setter, override parent class methods, etc. These two techniques are so commonly used that a bunch of main, System.out and getter/setter are generated almost every day.

In addition, Intellij IDEA 13 has added a postfix completion function (Postfix Completion), which is more flexible and powerful than template generation. For example, to enter for(User user : users) just enter user.for+Tab. For another example, to enter Date birthday = user.getBirthday(); just enter user.getBirthday().var+Tab.

4. Editing

The great magic key that I have to say in editing is the Ctrl+W that can automatically select the code according to the grammar and the reverse Ctrl+Shift+W. In addition, Ctrl+Left/Right moves the cursor to the previous/next word, and Ctrl+[/] moves to the previous/next code block. These Vim-like cursor movements are also a highlight. The above Ctrl+Left/Right/[] plus Shift can select the code within the jump range. Alt+Forward/Backward moves to the forward/backward method. There are also some very common ones like Ctrl+Y to delete lines, Ctrl+D to copy lines, and Ctrl+folding codes.

A little more about cursor movement, in addition to the functions provided by Intellij itself, we can also install ideaVim or emacsIDEAs to enjoy the fast movement of Vim and the AceJump function of Emacs (super cool!).

In addition, Intellij's bookmark function is also good, use Ctrl+Shift+Num to define 1-10 bookmarks (press this group of shortcut keys again to delete bookmarks), and then use Ctrl+Num to jump. This avoids the trouble of repeatedly using the previous/next editing position Ctrl+Left/Right to jump back and forth, and this shortcut key conflicts with the Windows hotkey by default (alt is added by default, which conflicts with Windows changing the display direction of the display, accidentally The display becomes upside-down and explicit, Jiong).

5. Find and open

Similar to Eclipse, Intellij's Ctrl+N/Ctrl+Shift+N can open classes or resources, but Intellij is smarter. Any character we enter will be regarded as a fuzzy match, saving you the trouble of typing * in Eclipse. The latest version of IDEA also adds the Search Everywhere function, just press Shift+Shift to search for anything in a pop-up box, including classes, resources, configuration items, methods, and more.

For the inheritance relationship of a class, you can use Ctrl+H to open the class hierarchy window, and to jump on the inheritance hierarchy, use Ctrl+B/Ctrl+Alt+B to correspond to the parent class or parent method definition and subclass or submethod implementation respectively, to view the current class All methods use Ctrl+F12.

It is also very simple to find the use of a class or method, Alt+F7. To find where the text appears, use Ctrl+F/Ctrl+Shift+F to search in the current window or the entire project, and then cooperate with F3/Shift+F3 to move back and forth to the next matching place.

Another proof that Intellij is smarter is that in any menu or display window, you can directly enter the word you are looking for, and Intellij will automatically filter it for you. Follow the WeChat official account of the Java technology stack, and reply to the keyword in the background: IDEA, you can get a copy of IDEA's latest technology dry goods organized by the stack manager.

6. Other assistance

With the above magic keys and some auxiliary shortcut keys, you can free your hands from the mouse for more than 90% of the time, and focus on the keyboard as if performing a piano performance. These humble but crucial final pieces of the puzzle are:

Ø Command: Ctrl+Shift+A can find all Intellij commands, and there are shortcut keys behind each command. So it is not only a great magic key, but also a tool for finding and learning shortcut keys.

Ø New: Alt+Insert can create new classes, methods and anything else.

Ø Format code: format import list Ctrl+Alt+O, format code Ctrl+Alt+L.

Ø Switching windows: Alt+Num, commonly used are 1-project structure, 3-search results, 4/5-running and debugging. Ctrl+Tab switches tabs, Ctrl+E/Ctrl+Shift+E opens the recently opened or edited file.

Ø Unit test: Ctrl+Alt+T to create a unit test case.

Ø Run: Alt+Shift+F10 to run the program, Shift+F9 to start debugging, Ctrl+F2 to stop.

Ø Debugging: F7/F8/F9 respectively correspond to Step into, Step over, Continue.

In addition, there are some customized ones, such as horizontal split screen Ctrl+|, etc., and some magical small functions Ctrl+Shift+V to paste what was copied a long time ago, and Alt+Shift+Insert to enter the column mode to select by column.

Ø Top #10 cut to cut: Ctrl+Tab

Ø Top #9 Choose what you want: Ctrl+W

Ø Top #8 code generation: Template/Postfix +Tab

Ø Top #7 Give orders: Ctrl+Shift+A

Ø Top #6 Nowhere to Hide: Shift+Shift

Ø Top #5 autocomplete: Ctrl+Shift+Enter

Ø Top #4 Create Everything: Alt+Insert

It's too hard to let go, let's tie for the top three!

Ø Top #1 smart completion: Ctrl+Shift+Space

Ø Top #1 Self-healing: Alt+Enter

Ø Top #1 Refactor everything: Ctrl+Shift+Alt+T

CTRL+ALT+ left/right Navigate the edited place before and after Ctrl+Shift+Backspace can jump to the last edited place

Guess you like

Origin blog.csdn.net/u012294515/article/details/100598305