vimrc icon indicating copy to clipboard operation
vimrc copied to clipboard

g=格式化后缩进是两格,clang-format的IndentWidth选项已经是4,怎么改?

Open fegei163 opened this issue 10 months ago • 1 comments

fegei163 avatar Mar 04 '25 10:03 fegei163

在项目目录下创建.clang-format文件,或者修改用户主目录下的~/.clang-format

❯ cat ~/.clang-format
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
BasedOnStyle: LLVM
Standard: c++20
IndentWidth: 4
AccessModifierOffset: -4
ColumnLimit: 80
DeriveLineEnding: false
UseCRLF: false
LineEnding: LF
InsertNewlineAtEOF: true
UseTab: Never
TabWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
IndentCaseLabels: false
IndentCaseBlocks: false
IndentRequiresClause: true
RequiresExpressionIndentation: OuterScope

把IndentWidth和TabWidth改成8就行了。

archibate avatar Aug 17 '25 03:08 archibate