Disable smart-indent Clion




How can I disable the smart indentation ?


Example :

int main(int a,

               char **av);


I want the number of spaces at the beginning of the second line to be a multiple of 4 when pressing the AutoIndent keys (Ctrl + Alt + I)


File | SettingsEditor | General | Smart Keys

-> Enter -> Smart indent

From CLion Forum


If this key is toggled, when pressing Enter I get a 4 spaces indentation.

If this key is not toggled, when pressing Enter I get a 0 spaces indentation.

If I press auto-indentation afterwards, I get a 9 spaces indentation in both cases.

I would like a 8 or 12 spaces indentation (the closiest to the auto-indentation when pressing the keys Ctrl + Alt + I).

I would like to change the auto-indentation settings which currently align perfectly both parameters under each others.


Oh I see, I think it's a bug, and I have the same issue actually.

According to the CLion documentation:

"Smart Indent - select this checkbox to have CLion add a new line and position the caret in it, with the indent that CLion assumes to be reasonable in the current point of code (indentation is based on the current Code Style settings)."

So here it means that CLion is not respecting your current Code Style, I would say it is a bug, easy to reproduce.

I think Enter should have the same behavior as CTRL + ALT + I

--- EDIT ---

For correctness, the behavior of the Enter Smart Key is following the "Continuation Indent" setting in File | Editor | Code Style, but the auto-indentation (CTRL + ALT + I, the one which is actually "correct") has a different behavior and I couldn't find a way to configure it in CLion, there doesn't seem to be one.


Thanks a lot for your replies. I will create a python script that opens my files and changes all lines that don't start with a multiple of 4 spaces.


Hi Nicolas.

You can try disabling the Align when multiline option in File | Settings | Editor | Code Style | C/C++ | Wrapping and Braces | Function declaration parameters.


Thank you very much. This is what I wanted.


Please sign in to leave a comment.