Intellij / Clion

Updated: 2021-12-16

Code Completion

Shortcut: Ctrl + Space

This feature is often used without explicitly invoking its keyboard shortcut. As code is written, context-aware completion suggestions pop up.

Search Everywhere

Shortcut: Shift + Shift

A great way to open up any file or symbol in your project. It presents a prompt that uses fuzzy logic to best guess what you mean with minimal input.

Switch File

Shortcut: Ctrl + Tab

Go To Definition

  • Shortcut (Linux): Ctrl + B or Ctrl + left click
  • Shortcut (macOS): ⌘ + B or ⌘ + left click

If the cursor is on a function, it will jump to the definition. If the cursor is on a variable, it will jump to the declaration. If the cursor is on an #include file path, it will open the file.

Easy #include

Shortcut: Alt + Enter

Change SDK and Language level (Java version)

File->Project Structure-> Project

change Project SDK and Project Language level

Set Working directory

In a multi-module project, the structure might be

project/
    moduleA/
        pom.xml
    moduleB/
        src/test/java/test.java
        pom.xml
    pom.xml

by default working directory is set to project root folder. To run test.java relative to moduleB folder, open configurations: Run->Edit Configurations...

and set Working directory to $MODULE_DIR$.

Convert to maven project

Right-click on the module, select Add framework support..., and check the Maven.

Multiple Cursors

Press Shift + Cmd + 8 to change to Column mode(there's a "Column" in the lower right corner), hold Shift and move up or down to create multiple cursors, then make the changes.

Shortcut for Insert Mode

Preferences -> Keycap -> Editor Actions -> Toggle Insert/Overwrite, add your own shortcut e.g. Shift+Ctrl+I

WebStorm FileWatcher

Two mistakes:

  1. I used less instead of lessc to compile .less files. Then suddenly, suddenly I realized, less in command line, has nothing to do with CSS… it is just a file viewer like more… that explains why the “compiled” css file looks exactly the same as its origin less file.

  2. error message

    env: node: No such file or directory

The solution is add PATH=/usr/local/bin to Environment variables in FileWatcher

Extra note about the FileWatcher: in command line we use lessc style.less > style.css to write to file. In FileWatcher, set only style.less in Arguments , and leave style.css in Output paths to refresh