Skip to content

Instantly share code, notes, and snippets.

@xeioex
Created August 27, 2025 23:44
Show Gist options
  • Save xeioex/746f1f0a11ed3643982f2182376b4cdd to your computer and use it in GitHub Desktop.
Save xeioex/746f1f0a11ed3643982f2182376b4cdd to your computer and use it in GitHub Desktop.
BasedOnStyle: LLVM
Language: Cpp
# General layout
ColumnLimit: 80
IndentWidth: 4
TabWidth: 4
UseTab: Never
MaxEmptyLinesToKeep: 2
# Braces and function signatures
BreakBeforeBraces: Stroustrup
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
# Prefer breaking before non-assignment binary operators (e.g. ||, &&)
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeTernaryOperators: true
# Calls, parameters, and alignment
AlignAfterOpenBracket: Align
BinPackArguments: false
BinPackParameters: false
ContinuationIndentWidth: 4
# Spaces around tokens
SpaceAfterCStyleCast: true
SpacesInParentheses: false
SpaceInEmptyParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
SpacesInAngles: Never
SpaceBeforeAssignmentOperators: true
# No space after function names; space after control keywords
SpaceBeforeParens: ControlStatements
# Granular control for newer clang-format versions (ignored by older ones)
SpaceBeforeParensOptions:
AfterControlStatements: true
AfterForeachMacros: true
AfterFunctionDeclarationName: false
AfterFunctionDefinitionName: false
#AfterFunctionCallName: false
AfterIfMacros: true
AfterOverloadedOperator: false
BeforeNonEmptyParentheses: false
# Pointer style: type + space + *name
PointerAlignment: Right
DerivePointerAlignment: false
# switch/case and labels
IndentCaseLabels: false # case labels align with 'switch'
IndentGotoLabels: false # labels at column 0
#LabelIndent: 0
# Declarations and comments
AlignConsecutiveDeclarations: true
AlignConsecutiveAssignments: false
AlignTrailingComments: true
SpacesBeforeTrailingComments: 2
ReflowComments: true
BreakStringLiterals: true
# Includes and preprocessor
SortIncludes: false
IncludeBlocks: Preserve
IndentPPDirectives: None
PPIndentWidth: 0
# Line endings
UseCRLF: false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment