Language: C

# Alignment
AlignAfterOpenBracket: true
AlignEscapedNewlines: Left
AlignOperands: AlignAfterOperator
PointerAlignment: Left

# Short Constructs
AllowShortBlocksOnASingleLine: Empty
AllowShortCaseExpressionOnASingleLine: false
AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty

# Breaking and Wrapping
AlwaysBreakBeforeMultilineStrings: true
BreakAfterOpenBracketBracedList: true
BreakAfterOpenBracketFunction: true
BreakAfterOpenBracketIf: true
BreakAfterOpenBracketLoop: true
BreakAfterOpenBracketSwitch: true
BreakAfterReturnType: TopLevelDefinitions
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeCloseBracketBracedList: true
BreakBeforeCloseBracketFunction: true
BreakBeforeCloseBracketIf: true
BreakBeforeCloseBracketLoop: true
BreakBeforeCloseBracketSwitch: true
BreakBinaryOperations: RespectPrecedence
BreakStringLiterals: false
ColumnLimit: 100

# Bin Packing
BinPackArguments: false
BinPackLongBracedList: false
BinPackParameters: OnePerLine

# Indentation
IndentGotoLabels: false
IndentWidth: 4
TabWidth: 4
UseTab: AlignWithSpaces

# Conventions
EnumTrailingComma: Insert
InsertBraces: true
NumericLiteralCase:
  ExponentLetter: Lower
  HexDigit: Upper
  Prefix: Lower
  Suffix: Upper
SeparateDefinitionBlocks: Always

# Empty Lines
KeepEmptyLines:
  AtEndOfFile: true
  AtStartOfBlock: false
  AtStartOfFile: false
RemoveEmptyLinesInUnwrappedLines: true

# Includes
IncludeBlocks: Merge
SortIncludes:
  Enabled: false # Preserve existing order

# Line Endings and File Format
InsertNewlineAtEOF: true
LineEnding: LF

# Penalties
PenaltyExcessCharacter: 5
PenaltyReturnTypeOnItsOwnLine: 0
