I have .clang-formatin my home directory and set indentwidth 4 as follows.
BasedOnStyle: LLVM
Standard: Cpp11
IndentWidth: 4
TabWidth: 4
UseTab: Never
But when I use clang-format -style='~/.clang-format' a.cppto format my code, the width of the indentation becomes 2. like:
int main(int argc, char const *argv[]) {
A a;
a.bar();
Output 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
How to enable clang-format format for my code (.h, .c, ..) with indentation width 4?
source
share