【发布时间】:2014-11-04 16:45:10
【问题描述】:
我的主目录中有.clang-format,并将缩进宽度设置为 4,如下所示。
BasedOnStyle: LLVM
Standard: Cpp11
IndentWidth: 4
TabWidth: 4
UseTab: Never
但是当我使用clang-format -style='~/.clang-format' a.cpp来格式化我的代码时,缩进宽度变成了2。比如:
// See this indent width 2. The original file has width 4,
// but clang-format changes it to width 2.
int main(int argc, char const *argv[]) {
A a;
a.bar();
clang-format --version 的输出是
LLVM (http://llvm.org/):
LLVM version 3.4.2
Optimized build.
Default target: x86_64-unknown-linux-gnu
Host CPU: core-avx-i
如何让 clang-format 格式化我的代码(.h、.c、..),缩进宽度为 4?
【问题讨论】:
标签: c++ clang-format