Skip to content

clang-format - Break each argument to new line #161718

@byk4

Description

@byk4

Hi I am new to .clang-format.
I want each argument on new line ex.

int
foo(
    int x, 
    int b)
{
	return (x + b);
}

but currently I am getting:

int
foo(int x, int b)
{
	return (x + b);
}

My current .clang-format is:

---
BasedOnStyle: Mozilla
AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveMacros: 'true'
AlignConsecutiveAssignments: 'true'
AlignConsecutiveDeclarations: 'true'
AlignEscapedNewlines: Right
AlignOperands: 'true'
AlignTrailingComments: 'true'
AlwaysBreakAfterDefinitionReturnType: All
AlwaysBreakAfterReturnType: All
AlwaysBreakBeforeMultilineStrings: 'true'
AlwaysBreakTemplateDeclarations: 'Yes'
BreakBeforeBinaryOperators: All
BreakBeforeBraces: Allman
BreakBeforeTernaryOperators: 'true'
BreakConstructorInitializers: BeforeComma
BreakInheritanceList: BeforeComma
BreakStringLiterals: 'true'
ColumnLimit: '80'
ConstructorInitializerIndentWidth: '8'
ContinuationIndentWidth: '8'
DerivePointerAlignment: 'true'
FixNamespaceComments: 'true'
IndentCaseLabels: 'true'
IndentPPDirectives: BeforeHash
IndentWidth: '8'
KeepEmptyLinesAtTheStartOfBlocks: 'false'
NamespaceIndentation: All
SortIncludes: 'false'
SortUsingDeclarations: 'true'
TabWidth: '8'
UseTab: Always
BinPackArguments: false
BinPackParameters: false

...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions