c++ - Setting IndentWidth doesn't work in clang-format -


I have .clang-format in my home directory and indentwidth 4 as the following set on.

But when I call clang-format- Style = ~ / .clang-format 'a.cpp to format my code, the indent width is 2. Like:

  // See the indent width 2. The original file width is 4, // but the clang-format it changes to width 2. Int main (int arguments, four consists * RGR []) {AA; Once();  

Clan-format-derived output

  LLVM (http://llvm.org/): LLVM version 3.4.2 is optimized. Default target: x86_64-unknown-linux-gnu host CPU: core-avx-i  

How can I tell my code to the claude-format format (.h, .c Indent width 4?

-style options It does not take any file path, it takes string file to indicate the use of a .clang-format file, and it is in the root directory of the file's processed file, or the working directory and Stdin looks at changing its original directories

You can also give it a string that sets the options directly to you:

  clang-format -style = "{IndentWidth: 4, TabWidth: 4} " 

You can also use the -dump-config option to check the config.


-style = '~ / .clang-format'

to reference your home directory Uses of ~ usually depends on shell globbing. Shell will not do this for you in any argument. So if -style has taken a path, then it will not produce the right path.


Comments

Popular posts from this blog

HTML/CSS - Automatically set height width from background image? -

php - Mysql Show Process - Sleep Commands and what to do -

c - What is the address of buf (the local variable in the main function)? -