5

Is it possible to change the options in Clion so that the variables are aligned like so:

enter image description here

This should be applied in structs and methods.

dimitris93
  • 4,155
  • 11
  • 50
  • 86

2 Answers2

11

Yes.

Settings -> Editor -> Code Style -> C/C++ -> Wrapping and Braces -> Variable groups -> Align in columns

You can of course also use a custom formatting tool that does it as well.

Zulan
  • 21,896
  • 6
  • 49
  • 109
  • Oh wow, thanks a lot, I didn't see that option being packed by 100 other options. – dimitris93 Feb 22 '16 at 10:21
  • I am sorry, is this possible to align the comments on the "right" as well ? so that the comments are aligned too ? have you seen that option ? – dimitris93 Feb 22 '16 at 10:22
  • Not sure if that is also possible. If not, you can also use an external tool for formatting, see: http://stackoverflow.com/q/34648255/620382 – Zulan Feb 22 '16 at 12:52
  • 2
    This setting behaves weirdly if you also change the space insert from before to after in `*` declarations. Apparently the `*` is still chosen as alignment character. – villasv Jan 21 '17 at 16:56
0

after all tuning you can also use shortcuts "Ctrl+Alt+L" to make alignment