[JAVA] Personally recommended Intellij IDEA initial settings (updated from time to time)

I will expose the settings of Intellij IDEA that I personally recommend.

Play around with Preferences

How to open the settings dialog

--For Windows or Linux Select File>Settings ... --For MacOS ʻIntelliJ IDEA> Select Preferences ...`

The following settings are made in this dialog

Make changes in Git visible at a glance

By default, files that have changed in Git are displayed in color. (↓ The changed file is blue. Subtly.) Screen Shot 2018-08-04 at 18.44.04.png

With this setting, the parent directory of the changed file will also be displayed in color. Screen Shot 2018-08-04 at 18.42.51.png

Setting method:

Version Control Check Show directories with changed descendants

Automatically download and import dependent libraries defined in Maven / Gradle

It automatically downloads the dependent libraries defined in Maven and Gradle's dependencies and makes them ready for use.

For Maven

Build, Execution, Deployment > Build Tools > Maven > Importing Check ʻImport Maven project automatically`

For Gradle

Build, Execution, Deployment > Build Tools > Gradle ʻCheck Use auto-import`

Automatically perform import organization

Set to automatically add necessary import statements when editing Java class

Setting method:

Editor > General > Auto Import Check ʻAdd unambiguous imports on the fly Check ʻOptimize imports on the fly

Prevent the cord from collapsing

Intellij folds and hides import statements etc. by default Screen Shot 2018-08-04 at 18.22.13.png

Since it is troublesome to open the folds one by one due to personal preference, I set it to display without folding.

Setting method:

Editor > General > Code Folding Uncheck all the Collapse by default: checkboxes

Enclose the selected part when you enter " " "or" { "with the text selected

If you do this setting, For example, if you enter " with text selected like ↓ ... Screen Shot 2018-08-04 at 18.27.49.png The selection will be surrounded by " . It's convenient. Screen Shot 2018-08-04 at 18.27.59.png

Setting method:

Editor > General > Smart Keys Check Surround selection on typing quote or brace

SQL dialect settings (* MySQL is assumed here)

If you select ʻUse MySQL` when it appears like this, Intellij will recognize it as MySQL SQL and will do completion, formatting, syntax error display, etc. Screen Shot 2018-01-31 at 9.41.22.png

It is troublesome to select one file at a time, so the method to set for the entire project is ↓. Preferences > Languages & Frameworks > SQL Dialects Select "MySQL" for Global SQL Dialects or Project SQL Dialects Screen Shot 2018-01-31 at 9.48.39.png

Automatically organize imports and apply formatter when saving Java files

When developing as a team, it is not good that there is a difference due to indentation etc., so I think it is better to use a formatter without asking questions.

  1. Install the Save Actions plugin
  2. Set ʻOther Settings> Save Actions` as ↓
Screen Shot 2018-12-03 at 17.24.23.png

Increase allocated memory (heap size)

Increase the heap size to make Intellij work lighter.

Setting method:

  1. Select Help> ʻEdit Custom VM Options ...`
  2. If the file ʻidea.vmoptionsdoes not exist, you will be asked if you want to create it, so selectCreate`.
  3. A file like ↓ is created and displayed. Screen Shot 2018-08-04 at 17.58.25.png
  4. Change the value of Xmx (maximum heap size). (In addition, if you also increase Xms (minimum heap size), startup may be a little faster)

Example:

-Xms256m
-Xmx1500m

Other recommended plugins

Recommended Posts

Personally recommended Intellij IDEA initial settings (updated from time to time)
[Eclipse] Summary of environment settings * Updated from time to time
Memorandum Poem (updated from time to time)
IntelliJ IDEA settings
[Reverse lookup] Spring Security (updated from time to time)
SpringBoot useful site collection (updated from time to time)
Settings to display Japanese Javadoc in IntelliJ IDEA
[Updated from time to time] Links that are indebted
Touch all Spring "Guides" (updated from time to time)
Introduction to programming for college students (updated from time to time)
[Updated from time to time] Ruby on Rails Convenient methods
[Personal memo] Frequently used Java grammar updated from time to time
Shortcut comparison for those migrating from Eclipse to IntelliJ IDEA (Windows)
How to convert param to hash with Rails controller (updated from time to time)
I translated the grammar of R and Java [Updated from time to time]
The secret to the success of IntelliJ IDEA
Convert from java UTC time to JST time
Points I stumbled upon when creating an Android application [Updated from time to time]
Git commands that new engineers should look back on [updated from time to time]