C语言-------简单代码风格.clang-format配置文件

简单代码风格.clang-format配置文件

# 对#include进行排序,匹配了某正则表达式的#include拥有对应的优先级,匹配不到的则默认优先级为INT_MAX(优先级越小排序越靠前),
#   可以定义负数优先级从而保证某些#include永远在最前面
IncludeCategories:
- Regex:           '^<ext/.*\.h>'
  Priority:        2
- Regex:           '^<.*\.h>'
  Priority:        1
- Regex:           '^<.*'
  Priority:        2
- Regex:           '.*'
  Priority:        3
# include块排序
IncludeBlocks: Preserve
IncludeIsMainRegex: '([-_](test|unittest))?$'
# 允许排序#include
SortIncludes: true

# 宏对齐
AlignConsecutiveMacros: AcrossEmptyLinesAndComments

# 允许重新排版注释
ReflowComments: true
# 尾行注释前的空格数
SpacesBeforeTrailingComments: 2
# 对齐连续的尾随的注释
AlignTrailingComments:	true

# 函数参数允许在下一行
AllowAllArgumentsOnNextLine: true
# 开括号(开圆括号、开尖括号、开方括号)后的对齐: Align, DontAlign, AlwaysBreak(总是在开括号后换行)
AlignAfterOpenBracket:	Align

# 缩进宽度
IndentWidth: 4
# 连续空行的最大数量
MaxEmptyLinesToKeep: 1
# 连续赋值时,对齐所有等号
AlignConsecutiveAssignments: true
# 连续声明时,对齐所有声明的变量名
AlignConsecutiveDeclarations:	false

# 水平对齐二元和三元表达式的操作数
AlignOperands:	true

猜你喜欢

转载自blog.csdn.net/qq_43577613/article/details/127445055