IDEA practical settings, improve the development speed.

1. Code prompt settings

File>Settings>Keymap>Main menu>Code>Completion
Basic Right-click>Remove Key to remove the default shortcut key and add a new shortcut key. Of course, Alt+/ is already occupied, you can find it (the magnifying glass on the right side of the search box, click the corresponding shortcut key to search, pay attention to the right side), delete it, or set something else.

It doesn't matter if SmartType is set or not, you can only prompt the type, it is not very useful.

2. Configure maven

People who often use maven usually have their own maven configuration files and repository directories. If they don't, they can be skipped here.

File>Settings>Build>Build Tool>Maven
will not talk about it here, all understand.

3. Chinese automatic transcoding of project code and properties file

File>Settings>Editor>File Encodings

The above one is the global code, and the other is the project code. Note that there is a check box below (Transparent native-to-ascii conversion), which means that the unicode encoding in the properties is activated to automatically convert to Chinese

3. Configure code generation templates through Live Templates

For example, configure a singleton pattern code generation

File>Settings>Editor>Live Templates

Create a new Java group, and create a new module named single (just take it)

code show as below

//单例模式
private static class Instance {
    private static final $CLASS_NAME$ ME = new $CLASS_NAME$();
}
public static $CLASS_NAME$ getInstance() {
    return Instance.ME;
}
private $CLASS_NAME$(){}

Click Edit variables

Set the Expression of CLASS_NAME to className() and click OK

Click on Define below and check Java>Declaration.

Then it's done.

Create a new class, enter single, and a prompt will appear. A carriage return code comes out automatically.

4. It is recommended to install plugins

Lombok Plugin (automatic successful GetSet and other methods, requires Jar package support)

CodeMaker (a simple code generator)

5. Some shortcut keys that have been memorized (IDEA default shortcut keys)

Ctrl+Alt+O optimize package import

Alt+Inert code generation rewrite and other stuff.

Alt+Enter (carriage return) inserts a new line

Ctrl+F9 to compile new code (including modified code, which can be used for springboot hot update)

Ctrl+Shift+Alt+Left mouse button Used to insert multiple cursors, not very useful.

Ctrl+N Quickly open java files

Ctrl+Shift+N Quickly open any file

Ctrl+Alt+L format code

Ctrl+G jump to the specified line

Ctrl+R find and replace

Ctrl+F Find

Shift+F6 rename (can realize global naming, change one place and all other places are automatically changed)

Ctrl+Alt+left mouse button to enter the implementation class of the interface or the subclass of the parent class

Ctrl+H cursor to select a class, you can view all subclasses of this class, or all implementations of interfaces.

Ctrl+Alt+H Cursor to select a method, you can see where the method is called.

Ctrl+Alt+U to view the structure diagram of the class (pop-up layer form)

Ctrl+Shift+Alt+UView class structure diagram (new window form)

Ctrl+Shift+FGlobal search

Ctrl+Shift+R global search and replace (rarely used)

Double-click Shift to quickly open the file, which is more practical

Ctrl+Alt+Y refresh all files

{{o.name}}
{{m.name}}

Guess you like

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