-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.clang-format
209 lines (203 loc) · 5.5 KB
/
.clang-format
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
---
AlignAfterOpenBracket: Align
AlignArrayOfStructures: Right
AlignOperands: Align
AlignTrailingComments:
Kind: Always
OverEmptyLines: 0
AllowAllArgumentsOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: false
AllowShortEnumsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All # Done.
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: Empty
AllowShortLoopsOnASingleLine: false
AlwaysBreakBeforeMultilineStrings: false
BinPackArguments: true
BinPackParameters: true
BitFieldColonSpacing: None
# Done.
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: All
BreakBeforeTernaryOperators: true
BreakStringLiterals: true
ColumnLimit: 0
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: Leave
IndentCaseBlocks: false
IndentCaseLabels: true
IndentGotoLabels: false
InsertBraces: false
IntegerLiteralSeparator:
Binary: 4
Decimal: 4
Hex: 0
KeepEmptyLinesAtTheStartOfBlocks: false
LambdaBodyIndentation: Signature
LineEnding: LF
MaxEmptyLinesToKeep: 1
ReflowComments: false
RemoveBracesLLVM: true
RemoveSemicolon: true
SeparateDefinitionBlocks: Leave
SpaceAfterLogicalNot: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeParens: Custom
SpaceBeforeParensOptions:
AfterControlStatements: true
AfterFunctionDeclarationName: false
AfterFunctionDefinitionName: false
AfterOverloadedOperator: false
AfterRequiresInClause: false
AfterRequiresInExpression: false
BeforeNonEmptyParentheses: false
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInConditionalStatement: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
...
---
Language: Cpp
IndentWidth: 4
IndentAccessModifiers: false # 使用 `AccessModifierOffset` 控制缩进
AccessModifierOffset: -2 # `public:` 的缩进与基础缩进叠加, 所以是负的.
AlignAfterOpenBracket: BlockIndent
# func_name(
# arg1, arg2
# )
AlignArrayOfStructures: Right
# {
# { 10, },
# { 2, }, // 右对齐
# }
AlignConsecutiveAssignments:
Enabled: true
AcrossEmptyLines: false # 不要跨空行对齐
AcrossComments: false # 不要跨注释对齐
AlignCompound: true # 对齐复合赋值
AlignFunctionDeclarations: false # 不对齐函数声明
AlignFunctionPointers: false
# unsigned i;
# int &r;
# int *p;
# int (*f)();
PadOperators: false # 紧凑
AlignConsecutiveBitFields:
Enabled: true
AcrossEmptyLines: false # 不要跨空行对齐
AcrossComments: false # 不要跨注释对齐
AlignCompound: true # 对齐复合赋值
AlignFunctionDeclarations: false # 不对齐函数声明
AlignFunctionPointers: false
AlignConsecutiveDeclarations:
Enabled: true
AcrossEmptyLines: false # 不要跨空行对齐
AcrossComments: false # 不要跨注释对齐
AlignCompound: true # 对齐复合赋值
AlignFunctionDeclarations: false # 不对齐函数声明
AlignFunctionPointers: false
AlignConsecutiveMacros:
Enabled: true
AcrossEmptyLines: false # 不要跨空行对齐
AcrossComments: false # 不要跨注释对齐
AlignCompound: true # 对齐复合赋值
AlignFunctionDeclarations: false # 不对齐函数声明
AlignFunctionPointers: false
AlignEscapedNewlines: Left
# #define A \
# int aaaa; \
# int b; \
# int dddddddddd;
BreakTemplateDeclarations: MultiLine # 函数声明需要多行则 template 单独一行
# template <typename T> T foo() {
# }
# template <typename T>
# T foo(int aaaaaaaaaaaaaaaaaaaaa,
# int bbbbbbbbbbbbbbbbbbbbb) {
# }
BreakAfterAttributes: Leave # 不动
BreakBeforeConceptDeclarations: Always
# template <class T> // 总是换行
# concept C = true;
CompactNamespaces: false
Cpp11BracedListStyle: true
FixNamespaceComments: true
IncludeBlocks: Preserve
SortIncludes: CaseInsensitive
IndentExternBlock: Indent
IndentPPDirectives: AfterHash
IndentRequiresClause: true
NamespaceIndentation: All
PPIndentWidth: 2
# #ifdef __linux__
# # define FOO
# #else
# # define BAR
# #endif
PackConstructorInitializers: NextLine
ConstructorInitializerIndentWidth: 0
PointerAlignment: Right
QualifierAlignment: Custom
QualifierOrder:
- constexpr
- inline
- friend
- static
- volatile
- restrict
- const
- type
ReferenceAlignment: Left
#RequiresClausePosition
RequiresExpressionIndentation: OuterScope
ShortNamespaceLines: 25 # 少于这么多行的 namespace 块的末尾不需要对称的注释
SortUsingDeclarations: Never
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeInheritanceColon: false
SpaceBeforeRangeBasedForLoopColon: true
SpacesInAngles: Never
Standard: Latest
SpacesInParensOptions:
ExceptDoubleParentheses: false
InConditionalStatements: false
InCStyleCasts: false
InEmptyParentheses: false
Other: false
SpaceBeforeCtorInitializerColon: false
# TODO: AlignConsecutiveShortCaseStatements
...
---
Language: JavaScript
JavaScriptWrapImports: true
...
# Local Variables:
# mode: yaml
# indent-tabs-mode: nil
# tab-width: 2
# End: