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.
IntelliJ IDEA lets you configure code style settings for each of the supported languages either at project or IDE level viaSettings→Code 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.