List of commonly used shortcuts and tips for IntelliJ Idea, intellijidea

Source: Internet
Author: User
Tags code tag

List of commonly used shortcuts and tips for IntelliJ Idea, intellijidea
IntelliJ Idea common shortcut keys
 
Alt + press enter to import the package, automatically corrected
Ctrl + N lookup class
Ctrl + Shift + N search for files
Ctrl + Alt + L format the code
Ctrl + Alt + O optimized imported classes and packages
Alt + Insert generate code (such as get, set method, constructor, etc)
Ctrl + E or Alt + Shift + C recently changed code
Ctrl + R replace text
Ctrl + F search for text
Ctrl + Shift + Space auto-completion code
Ctrl + space code prompt
Ctrl + Alt + Space class name or interface name prompt
Ctrl + P method parameter prompt
Ctrl + Shift + Alt + N find methods or variables in the class
Alt + Shift + C compare the recently modified code
 
Shift + F6 reconstruction-Rename
Ctrl + Shift + TOP key
Ctrl + X Delete rows
Ctrl + D copy rows
Ctrl +/or Ctrl + Shift +/comment (// or /*...*/)
Ctrl + J Automatic Code
Ctrl + E recently opened files
Ctrl + H display class structure diagram
Ctrl + Q show comments document
Alt + F1 locate code
Alt + 1 quickly open or hide the project panel
Ctrl + Alt + left/right return the previous browsing position
Alt + left/right switch Code view
Alt + Up/Down fast moving and locating between methods
Ctrl + Shift + Up/Down code move Up/Down.
F2 or Shift + F2 highlight error or warning quick locating
 
After the code tag is entered, press Tab to generate the code.
Select the text, press Ctrl + Shift + F7, highlight all the text, and Press Esc to highlight and disappear.
Press Ctrl + W to select the code, which has other effects.
Select the text, press Alt + F3, search for the same text one by one, and highlight it.
Ctrl + Up/Down Jump cursor to the first line or the last line
Ctrl + B quickly open the class or method at the cursor


Most common shortcut keys
1. Ctrl + E to 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. Press Ctrl + Shift + Backspace to jump to the Last edited location.
5. Press Ctrl + F12 to 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 to quickly open the class
8. Ctrl + Shift + N to quickly open the file
9. Alt + Q: You can see the declaration of the current method.
10. Ctrl + W can select the word and then the statement and then the row and then the Function
11. Alt + F1 can locate the elements being edited in each panel
12. Press Ctrl + P to display the parameter information.
13. Press Ctrl + Shift + Insert to select and Insert the clipboard content
14. Alt + Insert can generate Constructors/Getter/Setter, etc.
15. Ctrl + Alt + V can introduce variables. For example, assign the SQL statement 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 be quickly moved between methods
Below is not very useful
18. In some cases, press Alt + Enter to get some Intention actions. For example, change "=" to "equals ()"
19. Ctrl + Shift + Alt + N can quickly open the symbol
20. Ctrl + Shift + Space provides Smart prompts in many cases.
21. Alt + F3 can be quickly searched
22. Ctrl +/and Ctrl + Shift +/can comment out the code
23. Ctrl + Alt + B can jump to the implementation of the abstract Method
24. Ctrl + O you can select the parent class method for rewriting.
25. Ctrl + Q to view JavaDoc
26. Ctrl + Alt + Space is automatically completed by Class Name
27. wildcard characters or abbreviations can be used to quickly open a class/file/symbol.
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 to quickly jump to the search results
31. Ctrl + Shift + J can be integrated into two rows
32. Alt + F8 is the variable value.


IntelliJ IDEA tips
In the process of using InelliJ IDEA, I found many tips worth mentioning in the IDE that many Java Programmers like by searching for materials and some of my own explorations, 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... You can create the getter and setter methods for any fields in the class.
<? Xml: namespace prefix = v ns = "urn: schemas-microsoft-com: vml"/>


2. Right-click the breakpoint marker (in the Left bar of the text) to activate the quick query menu. You can quickly set the enable/disable breakpoint or condition attributes.


3. A special variable in the CodeCompletion attribute is the class name that can be completed or not in the current file by activating Ctrl-Alt-Space. If the class is not introduced, the import flag is automatically created.


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


5. You can use the CodeCompletion attribute to quickly complete various statements in the Code by pressing the first few letters in the Class Name field and then pressing Ctrl-Space to complete the full name. If there are multiple options, they will be listed in the Quick query list.


6. use Ctrl-/and Ctrl-Shift-/to comment out/uncomment code lines and code blocks.
-/Mark with a single line comment ("//… ) To comment out/uncomment the current row or select a code block. Ctrl-Shift-/can be marked with block annotations ("/*… */") To enclose the selected block. To uncomment a code block, 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. The edited class name is displayed twice in a row.


8. Use Refactor | Copy Class... You can create a "copy" of the selected class ". This is useful, for example, when you want to create a class with the same content as an existing class.


9. In the editor, Ctrl-D can copy the selected block or the selected block is the current row.


10. Ctrl-W (select a word) in the editor, the function is to select a word to take off the character, and then select the extension area of the source code. For example, first select a method name, then the expression that calls the method, then the entire statement, and then tolerate blocks.


11. If you do not want the highlighted ball icon indicating event details to be displayed in the editor, press the Alt-Enter key combination to open the list of all events and click it to make the highlighted ball of the event text attachment inactive.
In this way, there will be no bright ball indicating a special event, but you can still use it with the Alt-Enter shortcut key.


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


13. You can use the Escape key in any tool window to move the focus to the editor.
Shift-Escape not only moves 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 recently used tool window.


14. An easy way to view any expression value during program debugging is to select text in the editor (you can press Ctrl-W to perform this operation more effectively) then press the Alt-F8.


15. To open the browser of the class or method Java document used in the editor to take off the character, right-click the Shift-F1 (right-click the External JavaDoc menu ).
To use this function, you must set the path to the browser in the "General" option (Options | IDE Settings ), in addition, you must add the created Java document to the Project (File | Project Properties ).


16. With the Ctrl-F12 (View | File Structure Popup) key, you can quickly navigate in the currently edited File. The member list of the current class is displayed. Select an element and press Enter or F4. To easily locate an entry in the list, you just need to enter its name.


17. Place the cursor in the Code on the marker or its checkpoint and then press the Alt-F7 (right-click Find Usages... ) Quickly finds the location of a class, method, or variable used throughout the project.


18. Press Ctrl-N (Go to | Class... ) Then, you can enter the class name to quickly open any class in the editor. Select a class from the displayed drop-down list.
In the same way, you can use Ctrl-Shift-N (Go to | File... Open non-Java files in the project.


19. navigate to the declaration of classes, methods, or variables used in the code, place the cursor on the display item, and then press Ctrl-B. You can also press Ctrl and click the mouse button on the viewing point to go to the Declaration.


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


21. To view the Hierarchy of the selected class, press Ctrl-H (Browse Type Hierarchy. You can also activate the inheritance relationship view in the editor to view the inheritance relationships of the current editing class. 22. Use Ctrl-Shift-F7 (Search | Highlight Usages in File) to quickly Highlight the use of a variable in the current File. Press Escape to clear the highlighted image.


23. Use Alt-F3 (Search | Incremental Search) in the editor for quick Search.
In the "Search for:" prompt tool, enter a character and use the arrow to Search forward and backward. Press Escape to exit.


24. Press Ctrl-J to execute the abbreviated Live Template that you cannot remember. For example, press "it" and Ctrl-J to see what happened.


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


26. Press Ctrl-Shift-J to merge the two rows and remove unnecessary spaces to match your code format.


27. Ctrl-Shift-Backspace (Go to | Last Edit Location) transfers you to the Last place of the change in the Code.
Press Ctrl-Shift-Backspace several times to view the deeper modification history.


28. use Tools | Reformat Code... Refer to (view Options | IDE Setting | Code Style) to format the Code according to your Code Style.
Use Tools | Optimize Imports... You can set (view Options | IDE Setting | Code Style | Imports) to automatically "optimize" imports (clear useless imports, etc ).


29. Using IDEA Live Templates | Live Templates allows you to create a lot of typical code in the twinkling of an eye. For example, type in a method. Press the Tab key to see what happened.
Use the Tab key to move in different template domains. View Options | Live Templates for more details.


30. To view the modified Local History in a file, activate Local VCS in the right-click menu | Show History... . Maybe you can navigate to different file versions to see their differences and roll back to any previous version. You can also view the modification history in a directory using the same right-click menu entry. With this feature, you will not lose any code.


31. If you want to know the purpose of each entry in the main menu, move the mouse pointer to the menu entry, and then the status bar at the bottom of the application framework will display some brief descriptions of them, it may be helpful to you.


32. to display the separation lines between methods in the Editor, Open Options | IDE Settings | Editor and select the "Show method separators" check box (checkbox ).


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


34. jump between highlighted syntax errors with F2/Shift-F2 keys. You can use the Ctrl-Alt-Down/Ctrl-Alt-Up shortcut to jump between the compiler error message or the search results.


35. Press Ctrl-O (Code | Override Methods... ) Can easily reload the basic method. To complete the method of the implements (or abstract basic class) interface of the current class, use Ctrl-I (Code | Implement Methods... ).


36. If the cursor is placed between the brackets of a method call, press Ctrl-P to display a list of available parameters.


37. to quickly view the Java document of the class or method used in the editor's escape character, press Ctrl-Q (in Show Quick JavaDoc in the pop-up menu.


38. For example, Ctrl-Q (Show Quick JavaDoc shows simple Java documents), Ctrl-P (Show Parameter Info shows Parameter information), Ctrl-B (Go to Declaration to jump to Declaration ), shift-F1 (External JavaDoc External Java documentation) and some other shortcuts can be used not only in the editor, but also in the right-click list of code completion.


39. Press Ctrl-E (View | Recent Files) to pop up the right-click list of recently accessed Files. Press Enter to open the selected file.


40. In IDEA, you can easily rename your classes, methods, and variables and automatically correct them wherever they are used. Try, place the editor off the character on any variable name, and then press the Shift-F6 (Refactor | Rename... ). In the dialog box, type a new name to be displayed and then press Enter. You will browse all the places where this variable is used and then click "Do Refactor" to end the RENAME operation.


41. In any View (Project View, Structure View, or other View), you must quickly select the currently edited part (class, file, method, or field ), by Alt-F1 (View | Select in... ).


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


43. By using the SmartType code, it is very easy to create the entire anonymous implementation of the interface in idea. For example, for some listener listeners, you can type
Component component;
Component. addMouseListener (
New <caret is here>
);


Then press Ctrl-Shift-Space to see what happened.


44. It is helpful to use the SmartType code when you need to set the value of a known expression. For example, Type
String s = (<caret is here>
Press Ctrl-Shift-Space to see what will happen.


45. Fast query is provided in all views: You can quickly locate an entry by typing characters in the tree.


46. When you want to capture exceptions with a Code snippet, select the snippet in the editor and press Ctrl-Alt-T (Code | Surround... ) Then select "try/catch ". It automatically generates capture blocks for all exceptions thrown in the code snippet. In the Options | File Templates | Code tab, you can also customize the template that generates the capture block. Other items in the list can enclose other structures.


47. When the code is used, you can use the Tab key to enter the highlighted part in the pop-up list. Unlike using the Enter key to accept input, the selected name will overwrite other parts of the name on the right of the escape character. This is particularly useful when you replace another method or variable name.


48. When declaring a variable, the Code Completion feature will show you a suggested name. For example, start typing "private FileOutputStream" and press Ctrl-Space to customize the names of local variables, parameters, instances, and static fields in Options, IDE Setting, and Code Style.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.