# Based on https://gist.github.com/YodaEmbedding/c2c77dc693d11f3734d78489f9a6eea4 # Attempts to format C++ similar to rustfmt, with some modifications AccessModifierOffset: -2 AlignAfterOpenBracket: BlockIndent AlignConsecutiveMacros: false AlignConsecutiveAssignments: false AlignConsecutiveDeclarations: false AlignEscapedNewlines: DontAlign AlignOperands: false AlignTrailingComments: false AllowAllArgumentsOnNextLine: false AllowAllParametersOfDeclarationOnNextLine: false AllowShortBlocksOnASingleLine: Empty AllowShortCaseLabelsOnASingleLine: false AllowShortFunctionsOnASingleLine: Empty AllowShortIfStatementsOnASingleLine: Never AllowShortLambdasOnASingleLine: All AllowShortLoopsOnASingleLine: false AlwaysBreakAfterReturnType: None AlwaysBreakBeforeMultilineStrings: true AlwaysBreakTemplateDeclarations: Yes BinPackArguments: false BinPackParameters: false BreakBeforeBinaryOperators: NonAssignment BreakBeforeBraces: Attach BreakBeforeTernaryOperators: true BreakConstructorInitializers: AfterColon BreakInheritanceList: AfterColon BreakStringLiterals: false CompactNamespaces: false ConstructorInitializerIndentWidth: 4 ContinuationIndentWidth: 4 Cpp11BracedListStyle: true DerivePointerAlignment: false FixNamespaceComments: true IncludeBlocks: Regroup IncludeCategories: # - Regex: '^' # Priority: 0 # CaseSensitive: false - Regex: '^<.*\.(hpp|hh)>' Priority: 1 CaseSensitive: false - Regex: '^<.*\.h>' Priority: 2 CaseSensitive: false - Regex: '^<.*>' Priority: 3 CaseSensitive: false - Regex: '^".*\.(hpp|hh)"' Priority: 4 CaseSensitive: false - Regex: '^".*\.h"' Priority: 5 CaseSensitive: false IncludeIsMainRegex: '^$' IndentCaseLabels: true IndentPPDirectives: BeforeHash IndentWidth: 4 IndentWrappedFunctionNames: false KeepEmptyLinesAtTheStartOfBlocks: false MaxEmptyLinesToKeep: 1 NamespaceIndentation: None PackConstructorInitializers: CurrentLine PointerAlignment: Left ReferenceAlignment: Left ReflowComments: false SeparateDefinitionBlocks: Leave SortIncludes: true SortUsingDeclarations: true SpaceAfterCStyleCast: false SpaceAfterLogicalNot: false SpaceAfterTemplateKeyword: false SpaceBeforeAssignmentOperators: true SpaceBeforeCpp11BracedList: true SpaceBeforeCtorInitializerColon: true SpaceBeforeInheritanceColon: true SpaceBeforeParens: ControlStatements SpaceBeforeRangeBasedForLoopColon: true SpaceInEmptyParentheses: false SpacesBeforeTrailingComments: 1 SpacesInAngles: false SpacesInCStyleCastParentheses: false SpacesInContainerLiterals: false SpacesInParentheses: false SpacesInSquareBrackets: false Standard: c++23 TabWidth: 4 UseTab: Always ColumnLimit: 120 PenaltyBreakAssignment: 50 PenaltyBreakBeforeFirstCallParameter: 40 PenaltyBreakComment: 10 PenaltyBreakFirstLessLess: 100 PenaltyBreakOpenParenthesis: 50 PenaltyBreakScopeResolution: 80 PenaltyBreakString: 100 PenaltyBreakTemplateDeclaration: 100 PenaltyExcessCharacter: 100 PenaltyIndentedWhitespace: 50 PenaltyReturnTypeOnItsOwnLine: 70