You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

90 lines
2.5KB

  1. # This is for clang-format >= 9.0.
  2. #
  3. # clang-format --version
  4. # clang-format version 9.0.1 (Red Hat 9.0.1-2.module+el8.2.0+5494+7b8075cf)
  5. #
  6. # 详细说明见: https://clang.llvm.org/docs/ClangFormatStyleOptions.html
  7. # 部分参数会随版本变化.
  8. ---
  9. Language: Cpp
  10. # 基于 WebKit 的风格, https://www.webkit.org/coding/coding-style.html
  11. BasedOnStyle: WebKit
  12. # 以下各选项按字母排序
  13. # public/protected/private 不缩进
  14. AccessModifierOffset: -4
  15. # 参数过长时统一换行
  16. AlignAfterOpenBracket: AlwaysBreak
  17. # clang-format >= 13 required, map 之类的内部列对齐
  18. # AlignArrayOfStructures: Left
  19. # 换行符统一在 ColumnLimit 最右侧
  20. AlignEscapedNewlines: Right
  21. # 不允许短代码块单行, 即不允许单行代码: if (x) return;
  22. AllowShortBlocksOnASingleLine: false
  23. # 只允许 Inline 函数单行
  24. AllowShortFunctionsOnASingleLine: Inline
  25. # 模板声明换行
  26. AlwaysBreakTemplateDeclarations: Yes
  27. # 左开括号不换行
  28. BreakBeforeBraces: Custom
  29. BraceWrapping:
  30. AfterCaseLabel: false
  31. AfterClass: false
  32. # BraceWrappingAfterControlStatementStyle: MultiLine
  33. AfterEnum: false
  34. AfterFunction: false
  35. AfterNamespace: false
  36. AfterStruct: false
  37. AfterUnion: false
  38. AfterExternBlock: false
  39. BeforeCatch: false
  40. BeforeElse: false
  41. BeforeLambdaBody: false
  42. BeforeWhile: false
  43. IndentBraces: false
  44. SplitEmptyFunction: false
  45. SplitEmptyRecord: false
  46. SplitEmptyNamespace: false
  47. # 构造函数初始化时在 `,` 前换行, 和 `:` 对齐显得整齐
  48. BreakConstructorInitializers: BeforeComma
  49. # 继承过长需要换行时也在 `,` 前
  50. BreakInheritanceList: BeforeComma
  51. # 列宽 120
  52. ColumnLimit: 120
  53. # c++11 括号内起始/结束无空格, false 会加上
  54. Cpp11BracedListStyle: false
  55. # 命名空间后的注释会修正为: // namespace_name
  56. FixNamespaceComments: true
  57. #switch case的缩进
  58. IndentCaseLabels: true
  59. #允许单行case
  60. AllowShortCaseLabelsOnASingleLine: true
  61. # clang-format >= 13 required, lambda 函数内部缩进级别和外部一致, 默认会增加一级缩进
  62. # LambdaBodyIndentation: OuterScope
  63. # 命名空间不缩进
  64. NamespaceIndentation: None
  65. # PPIndentWidth: 2
  66. # */& 靠近变量, 向右靠
  67. PointerAlignment: Right
  68. # c++11 使用 {} 构造时和变量加个空格
  69. SpaceBeforeCpp11BracedList: true
  70. # 继承时 `:` 前加空格
  71. SpaceBeforeInheritanceColon: true
  72. # () 前不加空格, do/for/if/switch/while 除外
  73. SpaceBeforeParens: ControlStatements
  74. # 空 {} 中不加空格
  75. SpaceInEmptyBlock: false
  76. Standard: C++11
  77. # Tab 占 4 位
  78. TabWidth: 4
  79. # 不使用 TAB
  80. UseTab: Never
  81. ---
  82. Language: Java
  83. ---
  84. Language: JavaScript
  85. ...