Created
August 29, 2024 20:37
-
-
Save lunkums/e3a367ef812213888b833117e54ae2a5 to your computer and use it in GitHub Desktop.
id Software-inspired .clang-format
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
UseTab: Never | |
TabWidth: 4 | |
IndentWidth: 4 | |
# Braces | |
BreakBeforeBraces: Attach | |
AllowShortIfStatementsOnASingleLine: false | |
AllowShortFunctionsOnASingleLine: None | |
AllowShortEnumsOnASingleLine: false | |
# Spacing | |
SpaceBeforeParens: ControlStatements | |
SpacesInParentheses: true | |
SpacesInSquareBrackets: false | |
SpacesInAngles: false | |
SpaceAfterCStyleCast: false | |
SpaceBeforeAssignmentOperators: true | |
SpaceBeforeRangeBasedForLoopColon: true | |
# Alignment | |
AlignConsecutiveAssignments: true | |
AlignConsecutiveDeclarations: true | |
AlignTrailingComments: true | |
# Indentation | |
IndentCaseLabels: true | |
NamespaceIndentation: None | |
# Line breaks | |
ColumnLimit: 100 | |
KeepEmptyLinesAtTheStartOfBlocks: false | |
MaxEmptyLinesToKeep: 1 | |
# Pointer alignment | |
PointerAlignment: Left | |
# Function declarations | |
AllowAllParametersOfDeclarationOnNextLine: false | |
BinPackParameters: false | |
BinPackArguments: false | |
# Classes | |
AccessModifierOffset: -4 | |
# Naming conventions can't be enforced by ClangFormat, but we can set some related options | |
FixNamespaceComments: true | |
# Other | |
SortIncludes: true | |
ReflowComments: true | |
InsertNewlineAtEOF: true | |
# Include statements | |
IncludeCategories: | |
- Regex: '".*"' | |
Priority: 1 | |
- Regex: '^<.*\.h>' | |
Priority: 2 | |
- Regex: '^<.*' | |
Priority: 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment