I’ve been working with IDEA for a while, and I’ve become more and more dependent on it. Sometimes I have to use Eclipse, and it’s really painful.

And I found the IDEA has a lot of useful shortcuts, if master the practice, not only can effectively improve the work efficiency, but also being seen also will think you very cow force like bosses (doesn’t), so send a article writing, a collection to a new useful shortcuts will be written down, so there is no order, I learned a new will be added to the back), If you have any useful shortcut keys can also comment let me Kangkang.

Note that only IDEA, eclipse those will not write.

 

1. Press Ctrl + Shift + Enter

It can be used in several situations:

① First of all, it is suitable for quick line feed to the next line. When the cursor is not at the end of the code, but in the middle, this key can help us quickly move to the next line, saving the step of clicking to the end of the line with the mouse

Usage scenario: After typing two lines of code, suddenly want to insert a new line between two lines of code without touching the mouse, just use this shortcut key anywhere on the first line.

② Add the semicolon at the end of the code, use the code prompt of IDEA to automatically complete a piece of code or their own hand to type a line, the current line of code has ended, but there is no [;] At the right time.

Usage scenario: use code prompt to quickly type a line of code, the end of the gap is a [;] A semicolon character, but the cursor is not at the end of the line, so use the shortcut key anywhere on the current line.

③ Sometimes when we call a method, there will always be a missing () or {}, and we need to add it manually, but using this shortcut will automatically fill in the () or {}, and help you format the code to look better

Usage scenario: When using the if or method, use the shortcut key to automatically complete the parentheses and braces

 

2. Shortcut key Ctrl+Y

Delete the row where the cursor is located, rather than using the mouse to select and press DELETE. Some people would use Ctrl+ X instead, but I feel like it would contaminate the clipboard, ok but not necessary.

 

3. Shortcut key Ctrl+W

The function is just to select the word in the cursor, we do not need to manually double click, repeatedly press this shortcut key to select a larger area.

Ctrl+Shift+W Narrows the selection and is used in conjunction with Ctrl+ W.

Usage scenario: If you want to copy or change the word or paragraph of the current cursor position, you can use the shortcut key to replace the mouse selection. If you press more, you can select a larger range. If it’s just one word you can double click, if it’s two words or a line of code, it’s a little bit more difficult to use the mouse.

 

4. Shortcut keys Alt+ Shift + left mouse button

This key is mainly suitable for multi-line operations, batch copy and paste, delete, newline

Place the cursor in the first position specified, hold Alt+ Shift, and continue to left-click in other positions to see multiple cursors appear at the same time

Usage scenario: sometimes we need to turn the request parameters or return the entity class to write an API documentation, to each attribute names, types, annotations, one copy and paste into the web document, feel more trouble, can use this shortcut batch operation, Ctril + W currently selected word collocation, can also be a one-time select multiple words. This feature is definitely faster than moving word by word.

Note that if you click on the wrong cursor, you can cancel it by pressing the shortcut key once at that position. This function is not very common, but it can save some time when specified (batch copy and paste, delete, wrap, modify).

 

5. Shortcut key Ctrl+D

Immediately copy the line where the cursor is and paste it onto the next line (a new line instead of overwriting it).

If there is selected content, copy the selected content and paste it to the end of the selected content cursor.

Usage scenario: You need to write several lines of code that are very similar. Now that you have written the first line, you want to quickly copy and paste a few lines and modify them slightly. Use the shortcut key directly on the line (without selecting anything) and press it several times to paste more lines.

 

6. Shortcut key Ctrl+Alt+(left mouse button or B)

Another way to quickly jump to the interface’s implementation class is to click on the icon to the left of the interface:

If I want to find the abstract interface from the implementation class of the interface, so far I only find this method, also click the icon to the left of the method:

 

7. Shortcut keys Alt+ INSERT

After selecting a directory, you can use shortcut keys to quickly pop up the pop-up window for creating classes, packages or other files.

If used in code, the usual override methods like get, set, toString, equals(), test test cases, etc. are selected to quickly generate.

Usage scenario: At first, because my old computer would get stuck when I right-click to create a file and then wait several seconds for it to pop up, using this shortcut saved me from getting stuck. Now used to reduce the time to touch the mouse, it is still a bit useful.

 

7. Shortcut keys Alt+ Enter to quickly create an interface implementation class

Alt+ Enter is usually used for auto-completion or error correction, but here we can also use it to quickly create implementation classes for the interface.

Press Alt+ Enter on the created interface. The following dialog box is displayed. You can perform the following operations to quickly create an interface implementation class

Click implement Interface, and a box pops up with the generated implementation class name and package location. Of course, you don’t need to change the name, it’s already auto-complete for you, just change the location.

You can also choose which methods to implement in the interface.

 

8. Shortcut Keys You can customize shortcut keys to clear the console screen

There is no default shortcut key, but you can set your own shortcut key. After setting the following parameters in Settings, press R on the console to clear the screen

 

9. Shortcut keys Ctrl+Alt+ Arrow keys left and right

You can use this shortcut key to quickly return to the previous position of the cursor. If you press the arrow key several times, you can return to the previous position of the cursor N times. If you press the arrow key left ←, you can return the cursor to the previous position; if you press the arrow key right →, you can restore the cursor to the next position. It’s so easy to use that we don’t have to worry about losing our location because we just skip code.

It’s no exaggeration to say that this shortcut improves productivity by at least 10%.

 

10. Shortcut keys Ctrl+Alt+V

Through this shortcut can quickly create method return values as new variables, when we are in the new object or call a method, use this shortcut directly on the line, can automatically generate return and a variable name, variable type is the cursor on a variable name can be quickly modified, it will also provide a few recommended variable name for your use.

 

11. Shortcut key Ctrl+O

Use this shortcut to quickly pop up the option box to override the parent method when you need to override it.

 

12. Shortcut key Ctrl+N or shift twice

You can pop up a window in which you can obscure a file or class under the project by name. Slightly different, Shift searches global files, Ctrl+N searches Java classes.

 

13. Fast output of quick instructionsSystem.out.println()

Type sout and press Enter to quickly print system.out.println ().

 

14. Quick instructions to output the main() method quickly

Enter main to facilitate a lot of

 

15. Shortcut key Shift +F6

Quickly modify the variable name, the god of technology, at the same time, all use the variable changes of variables, at the same time also can be used in modified class name, method name, even on the package name, it will modify all the use of the method or class, by the way, than their direct each renamed high efficiency a lot of silly, also won’t change leak less, It also suggests some recommended variable names for you to choose from.

 

Reference links:

Blog.csdn.net/Logicr/arti…

Jingyan.baidu.com/article/607…