Skip to end of metadata
Go to start of metadata

Redirection Notice


Code style defines how code looks in terms of indents, spacing, wrapping, blank lines treatment, statements order, etc.

1. Reformat code

IntelliJ IDEA automatically applies code style you've configured as you edit, and in most cases you don’t need to callReformat Codeaction explicitly. However, you can do so anytime either for current file, selected piece of code, or even an entire directory by simply pressingAlt+Ctrl+L(Alt+Cmd+Lfor Mac.)

When you want to applyReformat Codeto an entire directory, use the same shortcut in theProject Tool Window.

2. Auto-indent lines

Another useful action isAuto-Indent Lines, which helps you to fix line indentation. This action sometimes is a better option thanReformat Code, because it does not require you to select anything. Just pressAlt+Ctrl+I(Alt+Cmd+Ifor Mac), and it will quickly fix indents for the current line.

3. Settings

IntelliJ IDEA lets you configure code style settings for each of the supported languages either at project or IDE level viaSettingsCode Style.

When you chooseProjectscheme in settings, you can share your code style with other team members via version control.

4. Tab character

Last, but not least of the settings worth your attention isUse tab character. By default this setting is off and IntelliJ IDEA uses regular spaces for indents instead of tabs. If you have files with lots of indents, you may want to optimize their size by selecting this option.

  • No labels

1 Comment

  1. Anonymous

    the first shortcut for linux will lock the pc !!!

    g Alt  Ctrl  L