Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
---
BasedOnStyle: GNU

# Alignment & indentation rules
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: Consecutive
AlignConsecutiveDeclarations: AcrossEmptyLinesAndComments
AlignArrayOfStructures: Left
AlignOperands: false
AlignTrailingComments: Always
AlignEscapedNewlines: LeftWithLastLine
IndentWidth: 4
ContinuationIndentWidth: 4
UseTab: Never
TabWidth: 4
IndentPPDirectives: None
IndentCaseBlocks: true
IndentCaseLabels: false
IndentGotoLabels: true
PointerAlignment: Right

AlignConsecutiveShortCaseStatements:
Enabled: true
AcrossEmptyLines: true
AcrossComments: true
AlignCaseColons: false

# Bracing style
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: true
AfterControlStatement: Never
AfterEnum: true
AfterFunction: true
AfterClass: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeElse: false
SplitEmptyFunction: true
SplitEmptyRecord: true
BreakAfterReturnType: None

# Keep lines from becoming too long (adjust to your preference)
ColumnLimit: 0

# Misc formatting
AlwaysBreakAfterReturnType: None
BinPackArguments: false
BinPackParameters: false
# BinPackLongBracedList: false
BreakBeforeTernaryOperators: true
InsertNewlineAtEOF: true
MaxEmptyLinesToKeep: 2
AlwaysBreakAfterDefinitionReturnType: None

# Include style
SortIncludes: Never
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^<.*'
Priority: 1
- Regex: '^".*'
Priority: 2
- Regex: '.*'
Priority: 3

# Spacing
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceBeforeSquareBrackets: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInConditionalStatement: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
...