Skip to content

Instantly share code, notes, and snippets.

@ronen-fr
Created August 9, 2022 11:39
Show Gist options
  • Save ronen-fr/0267e83e1d15ac71bf1db6fb40d77feb to your computer and use it in GitHub Desktop.
Save ronen-fr/0267e83e1d15ac71bf1db6fb40d77feb to your computer and use it in GitHub Desktop.
clang-format configuration (matching some requests)
---
Language: Cpp
BasedOnStyle: Google
AlignAfterOpenBracket: AlwaysBreak
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Inline
#AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: false
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: false
AllowAllConstructorInitializersOnNextLine: false
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
BinPackArguments: true
ColumnLimit: 80
MaxEmptyLinesToKeep: 2
EmptyLineBeforeAccessModifier: Leave
Cpp11BracedListStyle: true
BinPackParameters: false
BreakBeforeBraces: Custom
BraceWrapping:
SplitEmptyFunction: false
AfterCaseLabel: false
AfterClass: false
AfterStruct: false
AfterFunction: true
AfterControlStatement: Never
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
DerivePointerAlignment: true
IndentWrappedFunctionNames: false
PointerAlignment: Left
AlwaysBreakTemplateDeclarations: Yes
BreakConstructorInitializers: BeforeComma
KeepEmptyLinesAtTheStartOfBlocks: true
ContinuationIndentWidth: 2
TabWidth: 8
#UseTab: Never
UseTab: Always
Standard: c++17
FixNamespaceComments: true
AllowAllParametersOfDeclarationOnNextLine: false
LambdaBodyIndentation: Signature
# 14: PackConstructorInitializers: CurrentLine
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
PenaltyBreakComment: 0
#14 SeparateDefinitionBlocks: Leave
#ReflowComments: false
SortIncludes: true
IncludeBlocks: Regroup
IncludeCategories:
- Regex: 'debug.h'
Priority: 4
- Regex: '\"\./[^/]+\"'
Priority: 1
- Regex: '\"[^/]+\"'
Priority: 8
- Regex: 'boost'
Priority: 5
- Regex: '<.*\.h'
Priority: 2
- Regex: '<'
Priority: 3
- Regex: '.*'
Priority: 6
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment