Skip to content

Instantly share code, notes, and snippets.

@jharmer95
Last active July 19, 2022 15:10
Show Gist options
  • Save jharmer95/d8b2e3de40286682b7d525feedc07fcc to your computer and use it in GitHub Desktop.
Save jharmer95/d8b2e3de40286682b7d525feedc07fcc to your computer and use it in GitHub Desktop.
Clang Format configuration for C/C++
---
BasedOnStyle: Microsoft
AccessModifierOffset: -4
AlignAfterOpenBracket: DontAlign
AlignConsecutiveAssignments: None
AlignConsecutiveBitFields: true # 11
AlignConsecutiveDeclarations: None
AlignEscapedNewlines: Left
AlignOperands: DontAlign
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: false
AllowShortEnumsOnASingleLine: false # 11
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: Inline # 9
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: Yes # 7
BinPackArguments: true
BinPackParameters: true
BitFieldColonSpacing: After # 12
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: Allman
BreakBeforeConceptDeclarations: true # 12
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: AfterColon # 7
BreakStringLiterals: true
ColumnLimit: 120
CompactNamespaces: false
Cpp11BracedListStyle: false
DerivePointerAlignment: false
EmptyLineAfterAccessModifier: Never # 13
EmptyLineBeforeAccessModifier: Always # 13
FixNamespaceComments: true
IncludeBlocks: Regroup # 7
IndentCaseLabels: true
IndentGotoLabels: false # 10
IndentPPDirectives: AfterHash
IndentRequires: true # 14
IndentWidth: 4
IndentWrappedFunctionNames: false
#InsertBraces: true # 15
KeepEmptyLinesAtTheStartOfBlocks: false
Language: Cpp
MaxEmptyLinesToKeep: 1
NamespaceIndentation: Inner
PackConstructorInitializers: NextLine # 14
PointerAlignment: Left
PPIndentWidth: 2 # 13
QualifierAlignment: Custom # 14
QualifierOrder: ["inline", "static", "constexpr", "const", "volatile", "type"] # 14
ReflowComments: false
RemoveBracesLLVM: false # 14
#RequiresClausePosition # 15
SeparateDefinitionBlocks: Leave # 14
SortIncludes: Never
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCtorInitializerColon: true # 7
SpaceBeforeInheritanceColon: true # 7
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true # 7
SpaceInEmptyBlock: false # 10
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: Never
SpacesInCStyleCastParentheses: false
SpacesInConditionalStatement: false # 10
SpacesInLineCommentPrefix: # 13
Minimum: 0
Maximum: 1
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Latest
TabWidth: 4
UseCRLF: false # 10
UseTab: Never
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment