Created
August 23, 2025 01:38
-
-
Save CodeBoy2006/2bba0b382ea278b4d0d15040a44cd359 to your computer and use it in GitHub Desktop.
clang-format 算法竞赛配置文件
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # .clang-format | |
| BasedOnStyle: LLVM | |
| # —— 缩进用 Tab,对齐用空格(更稳妥)—— | |
| UseTab: ForIndentation # 缩进使用 Tab,水平对齐仍用空格 | |
| TabWidth: 4 # 一个 Tab 等于 4 列 | |
| IndentWidth: 4 # 每一级缩进 = 1 个 Tab(= TabWidth) | |
| # —— 紧凑度/可读性:更像竞赛模板 —— | |
| ColumnLimit: 0 # 不自动换行(模板/长宏更安全) | |
| ReflowComments: false # 不重排注释(题面/版权头不被重排) | |
| SortIncludes: false # 不改动 include 顺序(保留 <bits/stdc++.h> 等) | |
| IncludeBlocks: Preserve # 保留原有 include 分块 | |
| # —— 常见偏好 —— | |
| BreakBeforeBraces: Attach # 大括号同行(K&R/LLVM 风格) | |
| SpaceBeforeParens: Never # if/for/while 等前不留空格:if(...) | |
| PointerAlignment: Left # int* p 风格 | |
| DerivePointerAlignment: false | |
| IndentCaseLabels: true # switch 的 case 缩进,层级更清晰 | |
| KeepEmptyLinesAtTheStartOfBlocks: false | |
| SpaceAfterCStyleCast: false # (int)x 而不是 (int) x | |
| # —— 允许更紧凑的一行写法(常见于竞赛解法)—— | |
| AllowShortFunctionsOnASingleLine: All # 允许一行短函数/内联 | |
| AllowShortLoopsOnASingleLine: true # 允许一行 for/while/do-while |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment