-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.clang-format
34 lines (32 loc) · 1.67 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
BasedOnStyle: Google # 继承 Google 风格
ColumnLimit: 120 # 单行最大字符数120
IndentWidth: 2 # 缩进宽度2
UseTab: Never # 使用空格缩进
TabWidth: 2 # Tab 宽度2
ReflowComments: true # 自动调整 `/** ... */` 的换行格式
AllowShortFunctionsOnASingleLine: Empty # 允许短函数一行显示, Empty(允许空函数)
BreakConstructorInitializers: AfterColon # 构造函数初始化列表换行
ConstructorInitializerIndentWidth: 2 # 构造函数初始化列表缩进
ConstructorInitializerAllOnOneLineOrOnePerLine: true # 构造函数初始化列表一行或者一行一个
ContinuationIndentWidth: 2 # 换行缩进宽度2
; AlignConsecutiveAssignments: true # 启用连续赋值对齐
BreakBeforeBraces: Custom # 使用自定义大括号规则
BraceWrapping:
AfterClass: true # ✅ 类的大括号换行
AfterFunction: true # ✅ 函数的大括号换行
AfterStruct: true # ✅ struct 的大括号换行
AfterNamespace: true # ✅ 命名空间的大括号换行
AfterEnum: true # ✅ 枚举的大括号换行
AfterControlStatement: true # ✅ if/for/while 换行
BeforeElse: true # ✅ else 换行
BeforeCatch: true # ✅ catch 大括号也换行
IndentBraces: false # ❌ 大括号不额外缩进
##############################################################
# 如果你对某段代码的格式 非常满意,不希望 clang-format 修改它。
# 请使用 clang-format off/on 忽略代码块的功能
#
# // clang-format off
# 满意的代码片段, 不需要clang-format 修改它。
# // clang-format on
#
##############################################################