将下面的代码保存为_clang-format或者.clang-format放到被格式化的文件夹下即可
- 风格1
最多间隔3行
变量对齐,运算符对齐,行尾注释对齐(连续多行有注释,"//“)
函数短”return“放在一行
”include“按组整理,进行排序(include之间必须连续多行)
---
IndentWidth: 2
# BasedOnStyle: LLVM
---
Language: Cpp
AccessModifierOffset: 0
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignEscapedNewlines: Right
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine
BinPackArguments: true
BinPackParamete