Custom options in the special build of clang-format (these are not standard options)
IndentNestedBlocks: false
AllowNewlineBeforeBlockParameter: false
Language: Cpp
可选值有五种:
LLVM:一种遵循LLVM coding standards的样式。
Google:一种遵循Google’s C++ style guide的样式。
Chromium:一种遵循Chromium’s style guide的样式。
Mozilla:一种遵循Mozilla’s style guide的样式。
WebKit:一种遵循WebKit’s style guide的样式。
BasedOnStyle: Google
访问修饰符偏移量
AccessModifierOffset: -1
ConstructorInitializerIndentWidth: 4
SortIncludes: false
AlignAfterOpenBracket: true
左对齐
AlignEscapedNewlinesLeft: true
AlignOperands: false
注释对齐 true将左对齐
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
如果是true, 允许一个case在一行写完,默认为false。
AllowShortCaseLabelsOnASingleLine: false
是否允许方法单行
AllowShortFunctionsOnASingleLine: true
是否允许一行的if
AllowShortIfStatementsOnASingleLine: true
是否允许方法单行
AllowShortFunctionsOnASingleLine: All
是否允许循环单行
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: false
AlwaysBreakTemplateDeclarations: false
AlwaysBreakBeforeMultilineStrings: false
如果为 true,则将换行符后放置二元运算符。
BreakBeforeBinaryOperators: None
BreakBeforeTernaryOperators: false
BreakConstructorInitializersBeforeComma: false
BinPackArguments: true
如果为 false,函数调用或函数定义的参数将会都是在同一行上或者会有一行每个。
BinPackParameters: true
每行字符的长度 0不限制
ColumnLimit: 0
ConstructorInitializerAllOnOneLineOrOnePerLine: true
DerivePointerAlignment: false
ExperimentalAutoDetectBinPacking: false
switch的case缩进
IndentCaseLabels: true
IndentWrappedFunctionNames: false
IndentFunctionDeclarationAfterType: false
最多可以有连续几行空行
MaxEmptyLinesToKeep: 2
是否保留block里面开始的空行
KeepEmptyLinesAtTheStartOfBlocks: false
NamespaceIndentation: Inner
针对OC的block的缩进宽度
ObjCBlockIndentWidth: 4
针对OC,属性名后加空格
ObjCSpaceAfterProperty: true
OC里面,是否在Protocol名字列表前面加空格,默认为true。
ObjCSpaceBeforeProtocolList: true
PenaltyBreakBeforeFirstCallParameter: 10000
PenaltyBreakComment: 300
PenaltyBreakString: 1000
PenaltyBreakFirstLessLess: 120
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
指针的位置。默认为Right
PointerAlignment: Right
在尾部//注释前面加几个空格
SpacesBeforeTrailingComments: 1
Cpp11BracedListStyle: true
Standard: Auto
缩进宽度
IndentWidth: 4
TabWidth: 8
UseTab: Never
大括号的换行方式 如果 设置 Custom 函数的大括号对齐的,苹果的风格不是对齐的可用Attach
BreakBeforeBraces: Attach
BraceWrapping:
AfterClass: true
AfterControlStatement: false
AfterEnum: false
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: true
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
不在小括号里加空格
SpacesInParentheses: false
不在中括号里加空格
SpacesInSquareBrackets: false
是否在< >后边和前边插入空格,默认为false。
SpacesInAngles: false
是否在()里面插入一个空格。默认false。
SpaceInEmptyParentheses: false
SpacesInCStyleCastParentheses: false
括号后不加空格
SpaceAfterCStyleCast: false
@[]里面,是否在 [ 后和 ] 前加空格。默认为true
SpacesInContainerLiterals: true
= 前面是否有空格。默认为true
SpaceBeforeAssignmentOperators: true
ContinuationIndentWidth: 4
CommentPragmas: ‘^ IWYU pragma:’
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
在控制语句(for/if/while…)的(前面加空格
SpaceBeforeParens: ControlStatements
DisableFormat: false
…