Skip to content

Instantly share code, notes, and snippets.

@jhurliman
Last active October 20, 2018 18:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jhurliman/9aaf258fecc5940289c51e29a6aa7328 to your computer and use it in GitHub Desktop.
Save jhurliman/9aaf258fecc5940289c51e29a6aa7328 to your computer and use it in GitHub Desktop.
A reasonable clang-format configuration
# clang-format configuration file
#
---
DisableFormat: false
Language: Cpp
Standard: Cpp11
# Spacing
AccessModifierOffset: -4
ColumnLimit: 100
ConstructorInitializerIndentWidth: 8
ContinuationIndentWidth: 8
Cpp11BracedListStyle: true
DerivePointerAlignment: false
IndentCaseLabels: false
IndentWidth: 4
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: true
MaxEmptyLinesToKeep: 2
NamespaceIndentation: None
PointerAlignment: Left
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInContainerLiterals: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
TabWidth: 4
UseTab: Never
# Alignment
AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: DontAlign
AlignOperands: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: true
BinPackArguments: false
BinPackParameters: false
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: true
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: true
BreakStringLiterals: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
# Misc
AlignTrailingComments: true
CommentPragmas: ''
FixNamespaceComments: true
ForEachMacros: [ foreach ]
IncludeCategories: []
MacroBlockBegin: ''
MacroBlockEnd: ''
ReflowComments: true
SortIncludes: true
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment