Recommended IntelliJ IDEA settings
These are my must-have settings tweaks for IntelliJ IDEA, mixed with some useful tips.
However, I recommend going through all the preferences in the Settings Dialog yourself. You probably don’t even know about some problems the IDE can solve for you if adjusted correctly.
Table of Contents
- How to change settings
- Show current IDEA memory usage in the status bar
- Adjust for widescreen
- Zoom with the mouse wheel
- Show line numbers on the editor gutter
- Wrap long lines
- Improve tab appearance
- Sort debugger fields alphabetically
- Improve Java imports
- Remove unused sidebar panels
There are several ways to change settings in IntelliJ IDEA.
To open the Settings Dialog, select
File → Settings... or use the
S shortcut. You can then navigate through the settings in the left panel. Speed up the search by using quick find - simply type part of the setting name.
Sometimes you don’t even need to open the settings dialog. Press
A and type the setting name. If it’s a checkbox option, you can press
Return to toggle the setting - effective immediately!
File → Other Settings → Default settings....
Appearance & Behavior → Appearance → Show memory indicator
Activate this option to show the current IDE heap level and memory usage in the lower right corner of the status bar. Additionally, you can click on this widget to run the garbage collector.
For big projects you might want to increase the maximum heap memory size. Open
IDE_HOME\bin\idea[.exe].vmoptions and adjust the
Appearance & Behavior → Appearance → Widescreen tool window layout
If you have a widescreen monitor, you should enable this setting. Basically, this will give you more space for your side panels.
Notice: those screenshots are highly exaggerated to demonstrate the difference - usually, you wouldn’t open so many panels. If you do, consider the
F12 shortcut to toggle the panels and maximize the editor view.
Editor → General → Change font size (zoom) with Ctrl+Mouse Wheel
That’s a feature known from most other text editors and browsers, but it’s disabled by default. Enable this option to zoom using
Notice: zooming in/out is only temporary, it won’t affect other editor tabs.
Editor → General → Appearance → Show line numbers
That’s self explanatory. Additionally, press
G to navigate to a line number.
Editor > General > Use soft wraps in editor
Editor > General > (Console >) Use soft wraps in console
Editor > General > Use custom soft wraps indent/additional shift: 1
If you don’t like scrolling long lines horizontally, activate word wrapping. I also like to add a small indent. When you put the cursor on a wrapped line, IntelliJ will additionally insert small arrow symbols to highlight the wraps.
Editor → General → Editor Tabs → Hide file extension in editor tabs
Editor → General → Editor Tabs → Show “close” button on editor tabs
By hiding both file extensions and close icons you will gain a lot of free space in the editor tab panel. File icons are enough to infer the file types, and you are still able to close tabs by pressing the middle mouse key or
Hadi Hariri, who gives great talks about IntelliJ Tips and Tricks, recommends turning off editor tabs completely. Instead, use
E to switch between recent files and
E to switch between recently edited files. I’m currently trying out this idea (no pun intended), but it’s quite hard to quit the habit of using tabs.
Build, Execution, Deployment → Debugger → Data Views → Sort alphabetically
By default, debugger variables are listed in the order in which they were defined. I find this makes it harder to find the right values.
Bonus tip: you can focus any list/tree panel (like debugger variables or the project view) and search for a value by simply starting to type. If multiple values match the search string, use
↑ keys to step through them.
In this example I typed
mo, so I can toggle the selection between
Editor → General → Auto Import → Add unambiguous imports on the fly
This will add import statements automatically, if there is only one class in the classpath with the exact name.
Editor → General → Auto Import → Exclude from Import and Completion
Usually, if you want to use the
List class, IntelliJ won’t import it automatically, even with the previous option enabled. That’s because there are two
List classes in the classpath:
java.awt.List. Fortunately, you can exclude classes and packages from import assistance and code completion. It works exactly like Type Filters in Eclipse. I usually exclude:
and some project specific packages.
You don’t need to add those entries manually. Whenever IntelliJ suggests multiple classes to import, press
→ and select the class or package to exclude.
That’s a new feature in IntelliJ IDEA 15. Finally we are able to remove unwanted tool window buttons. Just right click a sidebar button and select Remove from sidebar. You can restore a hidden tool window with View → Tool Windows.