# Indentation

Indentation settings are configured for every programming language separately.

CLion displays the indentation information in the [status bar](guided-tour-around-the-user-interface.html#status-bar). So, if your project has files of different types, the easiest way of learning the current indentation style and accessing the corresponding settings is to use the  Indentation  widget.

![Indentation widget](https://resources.jetbrains.com/help/img/idea/2026.2/cl_indentation-widget.png)

Since indentation is configured separately for each programming language, the number of indentations displayed may vary between opened items. To view the indentation in the status bar, open a file containing the relevant code in the editor.

## Configure indentation style

In CLion, you can configure indents in [code style schemes](configuring-code-style.html) or in `[.editorconfig](editorconfig.html)` files.

> **Note:**
> To be able to use EditorConfig in your project, enable the [.editorconfig](editorconfig.html) plugin.

Code style schemes:

Procedure: Open indentation settings in the code style scheme

1. Click the widget and select Configure Indents for C/C++.

2. In the dialog that opens, you can change settings for tabs and indents and also configure other code style settings. Click OK.

3. [Reformat](reformat-and-rearrange-code.html) the necessary part of your project to apply new indentation settings.

EditorConfig:

Procedure: Open indentation settings in .editorconfig

Files in which code style settings are specified via [.editorconfig](editorconfig.html) files have the ![](https://resources.jetbrains.com/help/img/idea/2026.2/app-client.expui.ide.configFile.svg) icon in the widget.

1. Click the widget and select Open .editorconfig.

The IDE opens the nearest `.editorconfig` file which affects the file that you're currently working with. To view a list of all available `.editorconfig` files, click Show Files Related to Project….

![EditorConfig menu opened from the Indentation widget](https://resources.jetbrains.com/help/img/idea/2026.2/editorconfig-widget-menu.png)

2. Make your changes and [reformat](reformat-and-rearrange-code.html) the necessary part of your project to apply new indentation settings.

## Detect indents automatically

You can configure CLion to detect the indentation style in the current file and use this style instead of the indents specified in the code style settings for a specific language.

Procedure:

1. Press `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `⌘ Comma` (Xcode), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (ReSharper), `⌘ Comma` (ReSharper (macOS)), `Ctrl+Alt+S` (QtCreator), `⌘ Comma` (QtCreator (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) to open settings and then select `Editor | Code Style`.

2. Select the Detect and use existing file indents for editing checkbox.

3. Apply the changes and close the dialog.

To disable automatic indentation, go back to settings and deselect the checkbox or click the Indentation widget and select Disable Indents Detection.

## Show indent guides in the editor

An indent guide is a faint vertical line that helps you see the indentation levels of your code. You can enable indent guides in settings:

Procedure:

1. Press `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `⌘ Comma` (Xcode), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (ReSharper), `⌘ Comma` (ReSharper (macOS)), `Ctrl+Alt+S` (QtCreator), `⌘ Comma` (QtCreator (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) to open settings and then select `Editor | General | Appearance`.

2. Enable the Show indent guides option.  Apply the changes and close the dialog.

After that, vertical lines marking the indentation levels appear in the editor.

## See also

### Procedures

[EditorConfig](editorconfig.html) [Code style schemes](configuring-code-style.html) [Reformat code](reformat-and-rearrange-code.html)

### Reference

[Settings | Code Style](settings-code-style.html)

