preface

He that will do his work well must first sharpen his tools

Recently, I was invited by the department to train IDEA for new employees. I found that although many new employees use IDEA in daily development, they still do not use many useful skills, but only use some basic functions, which is quite a waste of IDEA, an excellent IDE.

At the same time, after this sharing, I also learned some new skills, so take this opportunity to share it together. I hope I can help some people.

IntelliJ IDEA 2018.2.2 (Ultimate Edition)

Knowledge overview:

1. Efficient configuration

2. Essential shortcut keys for daily use (★★)

To find the

Jump to switch

Coding related

Code reading correlation

Versioning related

3. Correlation of coding efficiency (★★)

File code template

Real-time code template

other

4. Code debugging source reading related (★★★)

View mode

Code debugging

.

5. Plug-ins

Plug-in installation and use

The plugin is recommended

6. Reference

Efficient configuration

1. Code prompts are case insensitive

Settings -> Editor -> General -> Code Completion

(For earlier versions, set Case Sensitive Completion to None.)

2. Automatic package guide function and related optimization function

Settings -> Editor -> General -> Auto Import

3. CTRL + slide the scroll wheel to adjust the display size of the window

Settings -> Editor -> General -> Change font size (Zoom) with Ctrl+Mouse wheel

Once selected, you can adjust the font size of the editor window by CTRL+ scroll

4. TAB displays multiple lines

This varies from person to person, some people like to just cancel all the tabs and use the shortcut keys, but I have a big screen, so I like to display all the tabs.

The effect is as follows:

5. Line numbers are displayed in the code editing area

Settings -> Editor -> General -> Appearance check Show Line Numbers

Essential Shortcut keys for Daily Use (★★)

1. Look for

2. Jump to switch

3. Coding is relevant

4. Code reading is relevant

5. Version management

See this article for more shortcuts at github.com/judasn/Int…

For MAC OS shortcuts, see this article github.com/judasn/Int…

Coding efficiency correlation (★★)

1. File code template

Settings -> Editor -> File and Code Template

Here you can see all the built-in file code templates of IDEA. When you select a file generation, the specified code file will be generated according to the template shown here.

In addition, you can set the file header here.

Once set, the effect is as follows

2. Live code templates

IDEA provides powerful real-time code templates, and many templates are built-in natively. For example, when you type sout or PSVM, system.out.println () will be generated quickly and automatically. Public static void main(String[] args) {}

The Templates for these can be seen in Settings -> Editor -> Live Templates. Users can become familiar with the relevant code templates according to their own usage habits.

3. Customize code templates

IDEA also provides the ability to customize your own real-time code templates.

1. Create your own template library

2. Create custom code templates

The MyGroup in the figure holds the code template I defined myself.

4. Other

CRTL+ALT+T

Ctrl + Alt + T provides code block wrapping – Surround With. You can quickly wrap the selected code block into the selected statement block.

5. Local history version

IDEA comes with local version management, which makes it easier to write code locally.

(★★★)

1. View mode

IDEA provides two special view modes.

Presentation Mode – For Code Review scenarios where Code needs to be shown

Distraction Free Mode — Zen Mode, which focuses on code development

Code debugging

2. Conditional breakpoints

IDEA can set breakpoints for specified conditions, increasing the efficiency of our debugging. IntelliJ IDEA Debug Java 8 Stream.

3. Forcibly return

IDEA can force the method return value you want to the caller at the interrupt point on the method stack. Very flexible!

4. Simulate exceptions

IDEA can force an exception to be thrown to the caller at the method stack at the break point. This is very useful when debugging source code.

5. Evaluate Expression

IDEA can also dynamically modify the values of variables in the current method stack when debugging code, which is convenient for debugging.

The plug-in side

1. Install the plug-in

File -> Setting -> Plugin

Plug-in installation, you can directly search for the installation in real time in the PLUGIN library of IDEA. browse plugin repository

For those with poor Internet access, check out plugins.jetbrains.com… After downloading the package, select Install from Disk

2. Plug-in recommendation

I use plug-ins in daily development.

Alibaba Java Coding Guidelines

Ali Java programming protocol plug-in.

FindBugs

Code defect scanning

PMD

Code defect scanning

InnerBuilder

Builder mode quick generation

lombok plugin

Lombok plug-in

maven helper

Maven relies on management assistants to parse Maven POM structures and analyze conflicts.

Rainbow brackets

Make parentheses in your code more identifying

String Manipulation

String related auxiliary simplification, with CTRL+W, ALT+J and other text selection shortcut keys to use

Translation

Translation plug-in, read the source code necessary

GenerateAllSetter

GenerateSerialVersionUID

Alt + Insert quickly generates SerialVersionUID

GsonFormat

RestfulToolkit

Quick jump to Restful Api (use: Ctrl(Command) + or Ctrl + Alt + N)

This section describes the Resultful interface structure

HTTP simple request tool

Material Theme UI

My own theme is this.

MyBatis Log Plugin

Mybatis output SQL log restore into a complete SQL statement, looks more intuitive.

Free Mybatis

MyBatis free plugin