IntelliJ IDEA Common Shortcuts List and Skills Daquan

IntelliJ Idea Common Shortcuts List


Alt+Enter to import the package, automatic correction

Ctrl+N Find class

Ctrl+Shift+N Find files

Ctrl+Alt+L Format code

Ctrl+Alt+O Optimize imported classes and packages

Alt+Insert generates code (such as get, set methods, constructors, etc.)

Ctrl+E or Alt+Shift+C recently changed code

Ctrl+R Replace text

Ctrl+F Find text

Ctrl+Shift+Space autocomplete code

Ctrl+space code hint

Ctrl+Alt+Space class name or interface name prompt

Ctrl+P method parameter prompt

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

Alt+Shift+C Compare recently modified code

Shift+F6 Refactor-Rename

Ctrl+Shift+Up key

Ctrl+X delete line

Ctrl+D Duplicate line

Ctrl+/ or Ctrl+Shift+/ Comment (// or /*...*/ )

Ctrl+J Autocode

Ctrl+E recently opened files

Ctrl+H Display class structure diagram

Ctrl+Q to display annotated documentation

Alt+F1 Find the location of the code

Alt+1 Quickly open or hide the project panel

Ctrl+Alt+ left/right Return to last browsed position

Alt+ left/right switch code view

Alt+Up/Down Quickly move positioning between methods

Ctrl+Shift+Up/Down Code moves up/down.

F2 or Shift+F2 Highlight errors or warnings to locate quickly

After entering the code label, press Tab to generate the code.

Select the text, press Ctrl+Shift+F7, highlight all the text, press Esc to highlight disappear.

Ctrl+W to select the code, continuous pressing will have other effects

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

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

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

Most frequently used shortcut keys

1. Ctrl+E, you can display the list of recently edited files

2.Shift+Click can close the file

3.Ctrl+[or] can jump to the beginning and end of braces

4. Ctrl+Shift+Backspace can jump to the last edited place

5.Ctrl+F12, you can display the structure of the current file

6. Ctrl+F7 can query the reference of the current element in the current file, and then press F3 to select

7.Ctrl+N, you can quickly open the class

8. Ctrl + Shift + N, you can quickly open the file

9.Alt+Q can see the declaration of the current method

10. Ctrl+W can select words, then statements, then lines, then functions

11.Alt+F1 can position the element being edited in each panel

12.Ctrl+P, can display parameter information

13. Ctrl+Shift+Insert can select the clipboard content and insert

14.Alt+Insert can generate constructor/Getter/Setter, etc.

15. Ctrl+Alt+V can introduce variables. For example, assign the SQL in parentheses to a variable

16. Ctrl+Alt+T can wrap the code in one piece, such as try/catch

17.Alt+Up and Alt+Down can move quickly between methods

The following is not very useful

18. Press Alt+Enter in some places to get some Intention Actions, such as changing "==" to "equals()"

19. Ctrl+Shift+Alt+N can quickly open symbols

20. Ctrl+Shift+Space can give Smart prompts in many cases

21.Alt+F3 can quickly find

22. Ctrl + / and Ctrl + Shift + / can comment code

23. Ctrl+Alt+B can jump to the implementation of the abstract method

24. Ctrl+O can select the method of the parent class to rewrite

25. Ctrl+Q can read JavaDoc

26.Ctrl+Alt+Space is the automatic completion of the class name

27. When opening classes/files/symbols quickly, you can use wildcards or abbreviations

28.Live Templates! Ctrl+J

29.Ctrl+Shift+F7 can highlight the use of the current element in the current file

30. Ctrl+Alt+Up /Ctrl+Alt+Down can quickly jump to search results

31.Ctrl+Shift+J can integrate two lines

32.Alt+F8 is to calculate the variable value

List of IntelliJ IDEA skills

In the process of using InelliJ IDEA, I found this IDE that many Java programmers like by searching for information and some of my own exploration.

There are many tips worth mentioning here. If you can skillfully apply them to the actual development process, I believe it will greatly save your development time, and there will be a little sense of accomplishment :) Try

it !

1. When writing code, use Alt-Insert (Code|Generate…) to create getter and setter methods for any field in the class.

 

2. Right-click the breakpoint marker (in the left column of the text) to activate the quick-check menu, you can quickly set the enable/disable breakpoint or condition its properties.

3. A special variable in the CodeCompletion property is that activating Ctrl-Alt-Space can complete class names in or not in the current file. The import flag is automatically created if the class is not imported.

4. Use the Ctrl-Shift-V shortcut to insert the most recently used clipboard content selection into the text. When using, the system will pop up a dialog box containing clipping content, from which you can select the part you want to paste.

5. Use the CodeCompletion (code completion) property to quickly complete various statements in the code by typing the first few letters of a class name and then using Ctrl-Space to complete the full name. If there are multiple options, they are listed in the cheat list.

6. Use Ctrl-/ and Ctrl-Shift-/ to comment/uncomment lines and blocks of code.

-/ Use a single-line comment marker (" //... ") to comment/uncomment the current line or selected block of code. Ctrl-Shift-/, on the other hand, encloses the selected block with block comment markers (“ /*…*/ ”). To uncomment a block of code just press Ctrl-Shift-/ anywhere in the block.

7. Press Alt-Q (View|Context Info) to view the declaration of the current method without moving the code. Press twice in succession to display the currently edited class name.

8. Use Refactor|Copy Class… to create a "copy" of the selected class. This is useful, for example, when you want to create a class that is mostly identical to an existing class.

9. In the editor, Ctrl-D can copy the selected block or the current line without the selected block.

10. The function of Ctrl-W (select word) in the editor is to first select the word at the caret, and then select the extension area of ​​the source code. For example, choose a method name, then the expression that calls the method, then the entire statement, then the containing block, and so on.

11. If you don't want the "bright ball" icon indicating the details of the event to be displayed in the editor, by pressing the Alt-Enter key combination to open the list of all events and clicking it with the mouse, you can set the bright ball attached to the event text to non Active status.

This way there will be no brighter balls indicating special events in the future, but you can still use it with the Alt-Enter shortcut.

12. When using CodeCompletion, you can use the comma ( . ) character, comma (,) semicolon (;), space and other characters to enter the currently highlighted part in the pop-up list. The selected name is automatically entered into the editor along with the characters entered.

13. Use the Escape key in any tool window to move the focus to the editor.

Shift-Escape not only moves the focus to the editor but also hides the current (or last active) tool window.

The F12 key moves the focus from the editor to the most recently used tool window.

14. An easy way to see the value of any expression while debugging a program is to select the text in the editor (you can do this more efficiently by pressing Ctrl-W a few times) and then press Alt-F8.

15. To open the browser for the Java documentation of the class or method used at the editor's caret, press Shift-F1 (External JavaDoc in the right-click menu).

To use this feature, you need to add the path to the browser, set it in the "General" option ( Options | IDE Settings ), and add the created Java document to the project ( File | Project Properties ).

16. With the Ctrl-F12 (View | File Structure Popup) keys you can quickly navigate in the currently edited file.

At this point it will display a list of members of the current class. Highlight an element to navigate and press Enter or F4. To easily navigate to an entry in the list, just type its name.

17. Put the cursor on the marker or its checkpoint in the code and press Alt-F7 (Find Usages... in the right-click menu) to quickly find a class, method or variable used in the entire project s position.

18. Press Ctrl-N (Go to | Class…) and then type the name of the class to quickly open any class in the editor. Select the class from the drop-down list that appears.

In the same way you can open non-Java files in a project by using Ctrl-Shift-N ( Go to | File… ).

19. To navigate the declarations of classes, methods or variables used in some places in the code, place the cursor on the view item and press Ctrl-B. You can also navigate to the declaration by pressing the Ctrl key and clicking the mouse button on the viewing point.

20. Put the cursor on the view point and press Ctrl-Alt-B to navigate to the implementation code of an abstract method.

21. To see the inheritance hierarchy of a selected class, press Ctrl-H ( Browse Type Hierarchy

) can be used. You can also activate the inheritance relationship view in the editor to view the inheritance relationship of the currently edited class. 22. Use Ctrl-Shift-F7 (Search |

Highlight Usages in File ) can quickly highlight the usage of a variable in the current file. Press Escape to clear the highlight.

23. Use Alt-F3 (Search | Incremental Search) to implement quick search function in the editor.

Enter characters in the "Search for:" tooltip and use the arrow keys to search forward and backward. Press Escape to exit.

24. Press Ctrl-J to execute some Live Template abbreviations you can't remember. For example, key "it" and then press Ctrl-J to see what happens.

25. Introduce Variable integration helps you simplify complex declarations in your code. For example, in the code snippet below, select an expression in the code: Then press Ctrl-Alt-V .

26. The Ctrl-Shift-J shortcut combines two lines into one line and removes unnecessary spaces to match your code format.

27. Ctrl-Shift-Backspace ( Go to | Last Edit Location ) lets you go to the last place where the changes were made in the code.

Press Ctrl-Shift-Backspace a few more times to see a deeper revision history.

28. Use Tools | Reformat Code… to format the code according to your code style reference (see Options | IDE Setting | Code Style).

Use Tools | Optimize Imports… to automatically "optimize" imports (clean out useless imports, etc.) based on settings (see Options | IDE Setting | Code Style | Imports).

29. Use IDEA's Live Templates | Live Templates allows you to create a lot of typical code in the blink of an eye. For example, typing in a method. Press Tab again to see what happens.

Use the Tab key to move through the different template fields. See Options | Live Templates for more details.

30. To view the local history modified in a file, activate Local VCS | Show History… in the right-click menu.

. Maybe you can navigate the different file versions, see how they differ and roll back to any previous version.

The history of modifications in a directory can also be viewed using the same right-click menu item. With this feature you won't lose any code.

31. If you want to understand the purpose of each item in the main menu, move the mouse pointer over the menu items and then the status bar at the bottom of the application frame will display some brief descriptions of them, which may help you.

32. To display the separator between methods in the editor, open Options | IDE Settings | Editor and select the "Show method separators" check box (checkbox).

33. Use the Alt-Up and Alt-Down keys to quickly move between different methods in the editor.

34. Use F2/Shift-F2 to jump between highlighted syntax errors. Use the Ctrl-Alt-Down/Ctrl-Alt-Up shortcuts to jump between compiler error messages or search results.

35. By pressing Ctrl-O (Code | Override Methods… ) you can easily override the basic class methods. To complete the current class

Implements (or abstract base class) interface methods, use Ctrl-I ( Code | Implement Methods… ).

36. If the cursor is placed between the parentheses of a method call, pressing Ctrl-P displays a list of available parameters.

37. To quickly view the Java documentation of the class or method used at the editor's caret, press Ctrl-Q (in the Show Quick JavaDoc in the pop-up menu).

38. Like Ctrl-Q (Show Quick JavaDoc to display concise Java documentation), Ctrl-P (Show Quick JavaDoc)

Parameter Info displays parameter information), Ctrl-B (Go to Declaration jumps to the declaration), Shift-F1 (

External JavaDoc) and other shortcuts can be used not only in the editor, but also in the code completion right-click list.

39. Ctrl-E (View | Recent Files) pops up a right-click list of recently accessed files. Select the file and press Enter to open it.

40. At IDEA

It's easy to rename your classes, methods and variables and automatically correct them wherever they are used. To try it out, place the editor caret on any variable name and press

Shift-F6 ( Refactor | Rename… ). Type the new name you want to display in the dialog box and press Enter

. You will browse to all places where this variable is used and press the "Do Refactor" button to end the rename operation.

41. To quickly select the currently edited part (class, file, method or field) in any view (Project View, Structure View or other view), press Alt-F1 (View | Select in… ).

42. You may use SmartType code to complete this feature when instantiating an object of a known type after the "new" character. For example, type and press Ctrl-Shift-Space:

43. By using SmartType code completion, it is also very easy to create the entire anonymous implementation of the interface in IDEA. For example, for some listeners, you can type

Component component;

component.addMouseListener(

new

);

Then press Ctrl-Shift-Space again to see what happens.

44. SmartType code completion is also helpful when you need to set the value of an expression of a known type. For example, type

String s = (

Press Ctrl-Shift-Space again and see what comes up.

45. Quick search function is provided in all views: just type characters in the tree to quickly locate an item.

46. ​​When you want to use a code snippet to catch exceptions, select the snippet in the editor and press Ctrl-Alt-T (Code | Surround with…

) and select " try/catch ". It automatically generates catch blocks for all exceptions thrown in the snippet. In Options | File Templates |

In the Code tab, you can also customize the template that generates the capture block. Other structures can be surrounded by other items in the list.

47. When using code completion, use the Tab key to enter the highlighted part in the pop-up list. Unlike the Enter key to accept input, the selected name overwrites the rest of the name to the right of the caret. This is especially useful when substituting one method or variable name for another.

48. The code completion feature will show you a suggested name when declaring a variable. For example, start typing " private FileOutputStream " and press

Ctrl-Space 在 Options | IDE Setting | Code Style

You can also customize names for local variables, parameters, instances, and static fields.



Author: Cytzrs
Link: https://www.jianshu.com/p/e2c6e58766f5
Source: Jianshu The
copyright belongs to the author. For commercial reprints, please contact the author for authorization, and for non-commercial reprints, please indicate the source.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324620865&siteId=291194637