Intellij idea shortcuts and tips

Source: Internet
Author: User
Tags code tag try catch
Intellij idea shortcut key (commonly used)

1. CTRL + Space

Complete Automatic Input of classes, methods, and variable names

2. CTRL + N (CTRL + Shift + n)

Jump to the specified Java file (other files)

3. CTRL + B

Jump to definition

4. CTRL + ALT + T

Use if, while, and try catch to enclose the selected code lines.

5. CTRL + ALT + B

Jump to method implementation

6. CTRL + W

Select by word. In idea, this shortcut key is used to select the word at the character where the cursor is located, and then select the source

Code extension area.

7. Shift + F1

Display the specified Java docs in the browser

8. CTRL + q

It is very convenient to display the Java docs function in the editor window-because sometimes I forget the meaning of a parameter in the method I wrote, and I don't want to start a browser to view the Java Doc at this time, at this time, the benefits of this function are shown.

9. CTRL +/

You can also use Ctrl + Shift +/to annotate the specified Statement (that is, use the multi-line comment symbol "/*... */")

10. F2/Shift + F2

Jump to the next/previous error statement

11. Shift + F6

Rename methods and variables

12. CTRL + ALT + L

The selected code is formatted according to the template and only valid for java files.
13. CTRL + ALT + I

Automatically indent the selected code. This function can also work when editing JSP files,

Provides a supplement to the CTRL + ALT + L function.

14. CTRL + ALT + O

Optimize import to automatically Remove useless import statements

15. CTRL +]/[

Jump to the end/start of the code block

16. CTRL + E

Display the list of recently edited files

17. Shift + Click

Close file

18. CTRL + Shift + backspace

Jump to the Last edited place

19. CTRL + F12

Display the structure of the current file

20. CTRL + F7

Query the reference of the current element in the current file, and then press F3 to select

21. CTRL + Shift + n

Quick file opening

22. Alt + q

See the Declaration of the current method

23. CTRL + P

Display parameter information

25. Alt + insert

Generate Constructors/getter/setter, etc.

26. CTRL + ALT + V

Introduce variables. For example, assign the SQL statement in parentheses to a variable.

27. Alt + up and ALT + down

Fast movement between methods

Below is not very useful

28. Alt + enter

Get some intention actions. For example, change "=" to "equals ()"

29. CTRL + Shift + ALT + n

You can quickly open a symbol.

30. CTRL + Shift + Space

In many cases, smart prompts are provided.

31. Alt + F3

Quick Search

32. CTRL + O

You can select the parent class method for rewriting.

33. CTRL + ALT + Space

Is automatically completed by Class Name

34. CTRL + J

Live Templates!

35. CTRL + Shift + F7

You can highlight the use of the current element in the current file.

30. CTRL + ALT + up/CTRL + ALT + down

Quick jump to search results

31. CTRL + Shift + J

Two lines can be integrated

32. Alt + F8 is the variable value.

CTRL + D copy the previous row or copy the selected

CTRL + ALT + L format the code

Alt + Shift + insert column editing

After upperlowercapitalize is installed

Alt + P // to uppercase

Alt + L // to lowercase

Alt + C // uppercase

In option -- keymaps, you can change it to your preferred key-bit combination.

Intellij idea shortcut key (other versions)

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 optimize the imported class and Package

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 find 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 search method or variable 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 file Ctrl + H display class structure Ctrl + q display comment document

Alt + F1 locate code

Alt + 1 quickly open or hide the project panel CTRL + ALT + left/right and return to 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: Quickly locate the code tag after the input is complete, 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. press Alt + F3 to find and highlight the same text one by one. CTRL + up/down jump 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

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 ),

Select the current editing location (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

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.

In options | ide setting | code style, you can also customize names for local variables, parameters, instances, and static fields.

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.