Configuring IntelliJ IDEA

Use the default IntelliJ key binding for your OS

As an Emacs Hacker since 1984, my default mode has been to set the keymap for every IDE I’ve used to Emacs emulation mode. You might do the same, or prefer Vim, or Eclipse bindings. Emulating another editor’s keyboard bindings is a mistake with IntelliJ IDEA.

The reason is that to use IntelliJ IDEA efficiently, you need to learn and use their key bindings, because they are optimized for the way expert users use the system. Believe me, I feel your pain, but it’s in your best long term best interest to do it their way.

Note: for MacOS users, the default keybinding is MacOS 10.5+.

Enable soft wrap

“Soft wrap” allows you to resize your screen and still see all text, and eliminates the need for horizontal scrolling.

To enable this, under Preferences > Editor > General, select:

I do not select “Show all soft wraps”, but that is a personal preference.

Disable wrap when typing reaches right margin

It is irritating for the editor to decide when to insert a newline.

To disable this, go to: Preferences > Editor > Code Style and uncheck “Wrap when typing reaches right margin”.

Click OK to save your changes.

Change default indentation and indentation for selected languages to two spaces and prevent use of tabs.

Under Preferences > Editor > Code Style, change the default indentation to:

Now open up that menu item for specific languages, and change the indentation for HTML, CSS, JavaScript, and XML, so that all of these file types have two space indentation.

Click OK to save your changes.

Here is a screen shot showing what a typical code style window should look like:

Do not select “Use tab character”. For this class, tab characters are prohibited.

MacOS-specific configuration

For MacOS, you need to do a few additional things to make IntelliJ keybindings work correctly.

(MacOS) Enable function keys

On Mac OS, function keys are disabled by default. Go to System Preferences > Keyboard, then check “Use all F1, F2 etc. keys as standard function keys”.

(MacOS) Disable system keyboard bindings

By default, you’ll see that some keyboard bindings (such as ctrl-arrow) have no effect. This is because they are bound by default to other MacOS tools (such as Mission Control). To get them to work in IntelliJ, you must unbind their system-level binding.

To do this, go to System Preferences > Keyboard > Shortcuts. Then click through the various tools (such as Mission Control) and disable their shortcuts if they conflict with IntelliJ. I just disable all of them except for the screen capture shortcuts.

(MacOS) Home and End key bindings

The MacOS laptop keyboard does not have Home or End keys. Here are their equivalents:

Thus, “goto beginning of line” is fn + left arrow, and “goto end of line” is fn + right arrow. To select the text while moving to the beginning or ending of line, add the shift key.

(MacOS) Delete and Backspace key bindings

The MacOS laptop keyboard has only a delete key, which is equivalent to the Windows backspace key. However, IntelliJ bindings use both the Delete and Backspace keys. Here are their equivalents:

Thus, “Delete forward word” is documented as “option + delete”, but on MacOS you use “fn + option + delete.

(MacOS) Understand MacOS keyboard symbology

The MacOS keyboard command reference uses strange symbols to denote various keys like command, option, and shift. To learn the symbol meanings, see MacOS Keyboard symbols.

Addressing performance problems

On my machine (MacOS, 2.7 Ghz i7, 16 GB RAM, 750 GB SSD), IntelliJ IDEA performance is quite acceptable. Some students, particularly those running Windows on older machines, have complained of slow compile and test times.

As a first step, if IntelliJ does not load within 10 seconds, the most likely culprit is your virus protection software. Please make sure your virus protection software is not checking the binaries or jars of IntelliJ on startup. The most simple test is to entirely disable virus protection and see if that fixes performance problems. If so, then selectively re-enable protection to avoid IntelliJ impact.

If virus protection is not the issue, you can try one or more of the following, which has worked in the past for other IntelliJ users:

More drastic measures include adding RAM or switching to a solid-state disk.