【IDEA efficiency Double series 】


Plug-in article


Shortcut Keys (2)

Ahem, in the last blog about IDEA, we introduced a lot of useful plugins.

﹏⊙… .Haven’t you seen it? A quick one: one item)

This article is going to cover the IDEA shortcuts that you can use. Mastering these shortcuts may not improve your actual development, but they can actually help you improve your OvO development.


I don’t know how to use IDEA at first. There are so many shortcut keys that I can’t handle Orz.

But don’t worry! Today we fully follow the official Keymap Reference and introduce each block.

Take you from zero to one, learn how to quickly use the shortcut keys of IDEA.

(Narrator: Wow, so many shortcut keys, this must be Orz… ..)


Ha ha, don’t worry, I will highlight some of the more commonly used, if you are interested in others, you can try it yourself!

Shortcut keys do not need to memorize, usually use to remember owO


I will mainly cover editing, refactoring, navigation, and search, of which editing and refactoring are used the most.


(Due to the large space, I am afraid that it is difficult for everyone to accept, so I decided to publish it in several articles)


Without further ado, let’s get started! (One item for a double impression while looking (●’◡’●)



Editing

1. Complete the code

Win :Ctrl + Shift + Enter

Mac:

This shortcut key is used to help us quickly complete the code, use frequency fried chicken fried chicken high!


Results show

As shown in the GIF, it can quickly help me complete semicolons at the end of sentences, formatting, line breaks, block blocks, etc. (haha, pretty much anything you can think of).


2. View method parameters

Win: Ctrl + P

Mac:

This shortcut is also used very frequently to help us quickly see the parameters in the method.

Especially when methods are overloaded, it is easy to get confused about the position and type of parameters.

The benefits of this shortcut are reflected in the various parameter positions and types are listed, very clear and easy to use.


rendering



3. Review documents quickly

Win: Ctrl + Q

Mac:

This shortcut key is also used very frequently, especially when we call some third-party methods, so that we can quickly see the function of the method and so on.

(This can also be combined with IDEA Settings, mouse hover will have the same effect)

(Tips: The version of my IDEA is 2020.1, the position of different versions may be different, just enter the corresponding text in the search box)


rendering


4. Generate code…

Win: Alt + Insert

Mac:

This shortcut helps us generate a lot of code quickly, greatly increasing our efficiency!

Can help us generate (Getters, Setters, Constructors, hashCode/equals, toString), etc

(At this time a pretty boy Lombok comes over with a smile haha (~ ▽ ~)”


rendering

Ha ha, is not particularly handsome feeling!!

With this shortcut, most of the time we do not need to consider the variable type and variable name, everything is left to IDEA

What do you say if the variable type is not what you want? Ha ha that oneself begin to change next bai 😜)


5. Fast rewrite methods/methods to implement interfaces

Win: Ctrl + O/I

Mac:

These two shortcuts help us to quickly override methods (from a parent or interface) at a good frequency (I’m using less than 2333)

  • Ctrl + O


  • Ctrl + I



6. Generate code containment blocks

Win: Ctrl + Alt + T

Mac:

This shortcut is mostly used to generate code wrap blocks (oddly named (LLL ¬ω¬))

Examples include if-else, try-catch, synchronized, and so on

Everybody understands next, know what use line ~


7. Quick notes

Win: Ctrl + (Shift) + /

Mac:

High frequency!!!!!

These two shortcuts will help you comment your code quickly.

Ctrl + / comment a single line

Ctrl + Shift + / comment multiple lines

The same goes for uncommenting


rendering

Tips:

Ctrl + / comments // at the top of each line, if you want to set it to GIF in front of the code, you need to set it manually



8. Close the current Tab page (manually modify)

Win: Ctrl + F4

Mac:

This shortcut key is also very common, can quickly help us close the current Tab page, especially when there are many Tab pages, one manual closing is very troublesome.

But given theCtrl + F4The shortcut for closing a Tab page in a browser that is inconvenient to use with one hand isCtrl + W, I’ll manually set it toCtrl + W


rendering

Manual setting shortcut keys:

9. Select contiguous code blocks (manually modified)

Win: Ctrl + (Shift) +W

Mac:

Tips: Since Ctrl + F4 has been changed to Ctrl + W, I will manually change this shortcut key to Ctrl + Alt + X, you can adjust it by yourself

This shortcut key is very much used, you can quickly select some code blocks, convenient for us to operate.

For example, select some variables and so on. The more times you press it, the more areas you can select.

Ctrl + Shift + W is the other way around.

rendering


10. Quick operation and quick repair

Win: Alt + Enter

Mac:

Fried chicken is often used!!

This shortcut can be used to quickly generate local variables, generate interface implementation classes and implement related methods, throw exceptions quickly, etc. (try using this shortcut wherever there are red lines.)

Really who uses it knows ha-ha OvO


Results show



11. Format code/remove unnecessary imports

Win: Ctrl + Alt + L/O

Mac:

These two shortcut keys are used quite a lot, one key double connection, can help us to format the code, will look more clean, beautiful.


rendering






12. Quickly indent

Win: Tab/ Shift + Tab

Mac:

Tab increases indentation, Shift + Tab decreases indentation.






rendering






13. Cut, copy, paste, etc

Win: Ctrl + X/C/V/D

Mac:

These shortcuts are very familiar to us.

Ctrl + X — Cut

Ctrl + C — Copy

Ctrl + V — Paste

Ctrl + D — Copies the selected code block. (I often copy a line with Ctrl + D and Ctrl + X)






14. Quickly switch case

Win: Ctrl + Shift + U

Mac:

This shortcut can quickly toggle the case of variables.


15. Quickly fold code blocks

Win: Ctrl + (Shift) + NumPad+/-

Mac:

This shortcut helps us collapse blocks of code quickly, making it easier to read the code.

Ctrl + NumPad+/- Local

Ctrl + (Shift) + NumPad+/- Global


Results show

Wuhu, after reading these shortcut keys, don’t you feel like taking off hahaha. 😀

Don’t worry, there’s more to come!


Next up

One item for the Editing section: Refactor has the most items, and one item will be updated soon (●’◡’●).

If there are any mistakes in this article, please comment on them

If you feel helpful, please like 👍 oh, thank you for your support!