Skip to content

Commit a9d279e

Browse files
committed
style: Add Clang-Format file configuration
1 parent 3bfa8ee commit a9d279e

1 file changed

Lines changed: 62 additions & 0 deletions

File tree

.clang-format

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# ==============================================================================
2+
# Minimalist Clang-Format Configuration (Baseline)
3+
# ==============================================================================
4+
Language: Cpp
5+
Standard: c++20
6+
7+
# 1. Non-Destructive Core Setting
8+
# ------------------------------------------------------------------------------
9+
# Completely disable automatic line wrapping to preserve manual formatting.
10+
ColumnLimit: 0
11+
12+
# 2. Indentation & Tabs
13+
# ------------------------------------------------------------------------------
14+
UseTab: ForIndentation
15+
IndentWidth: 2
16+
TabWidth: 2
17+
ContinuationIndentWidth: 2
18+
AccessModifierOffset: -2
19+
IndentCaseLabels: true
20+
AlignTrailingComments: true
21+
22+
# 3. Braces Style: Allman
23+
# ------------------------------------------------------------------------------
24+
BreakBeforeBraces: Custom
25+
BraceWrapping:
26+
AfterCaseLabel: true
27+
AfterClass: true
28+
AfterControlStatement: Always
29+
AfterEnum: true
30+
AfterFunction: true
31+
AfterNamespace: true
32+
AfterStruct: true
33+
AfterUnion: true
34+
BeforeCatch: true
35+
BeforeElse: true
36+
IndentBraces: false
37+
38+
# 4. Pointers & Spaces
39+
# ------------------------------------------------------------------------------
40+
PointerAlignment: Left
41+
SpacesInParentheses: false
42+
43+
# 5. Legacy & Compatibility (VC6 / Custom Macros)
44+
# ------------------------------------------------------------------------------
45+
# Prevent expanding/collapsing short blocks and functions to minimize diffs
46+
AllowShortFunctionsOnASingleLine: All
47+
AllowShortBlocksOnASingleLine: Always
48+
49+
# Preserve spaces in template brackets (e.g., `> >`) for VC6 compilation
50+
SpacesInAngles: Leave
51+
52+
# Handle custom legacy macros so the parser doesn't break
53+
AttributeMacros: ['CPP_11']
54+
Macros:
55+
- CPP_11(:x)=
56+
57+
IndentPPDirectives: BeforeHash
58+
ConstructorInitializerIndentWidth: 2
59+
60+
# 6. Includes
61+
# ------------------------------------------------------------------------------
62+
SortIncludes: false

0 commit comments

Comments
 (0)