Skip to main content
1 of 2

After some further research, I came across clang-format which works great with vim. I would have preferred a solution with a simple indentation file, but this works for me. The relevant options seem to be:

AlignAfterOpenBracket: Align 
AlignAfterOpenBracket: Align
BreakBeforeBinaryOperators: true
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: true
ColumnLimit:     80
IndentWidth:     4
TabWidth:        8

This solves the first three cases. Unfortunately, I was not able to figure out how to implement that "Line wrapping for if statements should generally use the 8-space rule" ("since conventional (4 space) indentation makes seeing the body difficult"). Any ideas?