I would like to customize the "k&r" indentation style, so that continuation lines are indented 8 spaces, like this:
if (first && second) { // <- 8 spaces. third(); } --
CLARIFICATION: Basically, I would like to distinguish easily between a block header and nested statements, to avoid confusion; for example:
if (first && second) { // <- Block header (4 spaces). third(); // <- Nested statement (same 4 spaces). } I have seen some code indented like the following, to address the above issue:
if (first && second) { // <- Block header (4 spaces). third(); // <- Nested statement (8 spaces). } But, to me, the above indentation looks confusing. I would rather have the opposite indentation:
if (first && second) { // <- Block header (8 spaces). third(); // <- Nested statement (4 spaces). } Such a differentiation would suffice. Function arguments inside a block header should be distinguishable, too, but - in that case - the actual amount of indentation would not matter:
if (first && second // <- Block header (8 spaces). && third( // <- Block header (8 spaces). fourth)) { // <- Function argument (any indentation). fifth(); // <- Nested statement (4 spaces). }
&& ...a continuation line but not}? After all, you could write the whole thing on a single line.&& secondis the same as that ofthird();the leading&&is a tell-tale sign that this is not the beginning of a block.