Skip to content

Instantly share code, notes, and snippets.

@qis
Last active May 2, 2021 20:44
Show Gist options
  • Save qis/0527881f8a81a540f6c191c3db737295 to your computer and use it in GitHub Desktop.
Save qis/0527881f8a81a540f6c191c3db737295 to your computer and use it in GitHub Desktop.
# Clang-Format Configuration
---
BasedOnStyle: LLVM
# Indent
ConstructorInitializerIndentWidth: 2
ContinuationIndentWidth: 2
IndentPPDirectives: AfterHash
IndentWrappedFunctionNames: false
# Alignment
AlignAfterOpenBracket: DontAlign
AlignEscapedNewlines: Left
AlignOperands: DontAlign
PointerAlignment: Left
# Breaks
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: None
AllowShortLambdasOnASingleLine: Empty
AllowShortLoopsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: Never
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: MultiLine
AfterEnum: false
AfterFunction: true
AfterNamespace: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: true
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
BreakBeforeBraces: Custom
BreakConstructorInitializers: BeforeComma
BreakInheritanceList: AfterColon
ConstructorInitializerAllOnOneLineOrOnePerLine: false
KeepEmptyLinesAtTheStartOfBlocks: false
MaxEmptyLinesToKeep: 2
# Spaces
Cpp11BracedListStyle: false
SpacesInContainerLiterals: false
# Columns
ColumnLimit: 120
PenaltyBreakAssignment: 100
PenaltyBreakBeforeFirstCallParameter: 10
PenaltyBreakComment: 100
PenaltyBreakFirstLessLess: 100
PenaltyBreakString: 1000
PenaltyExcessCharacter: 10
PenaltyReturnTypeOnItsOwnLine: 10000
# Comments
ReflowComments: false
SpacesBeforeTrailingComments: 2
CommentPragmas: '^ (NOTE|TODO):'
# Sorting
SortUsingDeclarations: false
# Line Endings
DeriveLineEnding: false
UseCRLF: false
---
Language: Cpp
Standard: c++20
# Includes
SortIncludes: true
IncludeBlocks: Preserve
IncludeCategories:
# Relative Paths
- Regex: '^"'
Priority: 1
# Project Headers
- Regex: '^<ice/'
Priority: 2
SortPriority: 0
# Windows Core Headers
- Regex: '^<(ntifs|windows)\.h>'
Priority: 3
# Windows Driver Headers
- Regex: '^<(ntddk|wdm)\.h>'
Priority: 4
# Windows Headers
- Regex: '^<(wdf|shellapi|winsock2|ws2tcpip|mswsock)\.h>'
Priority: 5
# GTest Headers
- Regex: '^<(gtest|gmock)/'
Priority: 6
SortPriority: 0
# Library Headers
- Regex: '^<.*\.'
Priority: 7
# C Compatibility Headers
- Regex: '^<c(a|c|e|f|i|l|m|s|t|u|w)'
Priority: 9
# C++ Standard Library Headers
- Regex: '^<'
Priority: 8
# Sources: a.hpp is main include for a.cpp, a_test.cpp, etc.
IncludeIsMainRegex: '(_test|_win32|_posix)?$'
# Headers: a.hpp, a_base.hpp, etc. are main includes for a.cpp
IncludeIsMainSourceRegex: '(_base|_impl)?$'
---
Language: ObjC
DisableFormat: true
---
Language: Java
BreakAfterJavaFieldAnnotations: true
---
Language: JavaScript
JavaScriptQuotes: Double
JavaScriptWrapImports: true
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment