# A .clang-format file to adhere to the K&R style # - CLANG-FORMAT STYLE OPTIONS: https://clang.llvm.org/docs/ClangFormatStyleOptions.html # # Author: Munseong Jeong BasedOnStyle: LLVM IndentWidth: 4 UseTab: Never # === Struct/Union/Class member indentation === # These options control indentation of struct members to ensure consistent # 4-space indentation for all struct/union/class members IndentAccessModifiers: false AccessModifierOffset: 0 NamespaceIndentation: All BreakBeforeBraces: Attach BraceWrapping: AfterControlStatement: false AfterFunction: false AfterClass: false AfterStruct: false # AfterStruct: false keeps struct opening brace on same line (K&R style) # Struct members will still be indented with IndentWidth: 4 AfterUnion: false AfterNamespace: false AfterEnum: false BeforeCatch: false BeforeElse: false IndentBraces: false # IndentBraces: false ensures braces themselves are not indented, # but content inside braces respects IndentWidth setting AllowShortIfStatementsOnASingleLine: false AllowShortLoopsOnASingleLine: false AllowShortBlocksOnASingleLine: Always # AllowShortFunctionsOnASingleLine: None enforces function bodies # to always be on separate lines, following K&R convention AllowShortFunctionsOnASingleLine: None IndentCaseLabels: true SpaceAfterCStyleCast: false ColumnLimit: 150 MaxEmptyLinesToKeep: 1 Cpp11BracedListStyle: false AlignTrailingComments: true ReflowComments: true SpacesBeforeTrailingComments: 2 IncludeBlocks: Regroup IncludeCategories: - Regex: '<[[:alnum:].]+>' Priority: 1 # System headers (angle brackets) have highest priority - Regex: '.*' Priority: 2 # Project headers (quotes) have lower priority SortIncludes: CaseSensitive AlignEscapedNewlines: Left