rhysd/vim-clang-format

indent is not correct

tracyone opened this issue · 3 comments

clang-format version 4.0.0 (tags/google/testing/2016-08-03)

vim config:

"linux kernel coding stype
set tabstop=8  "number of spaces a <Tab> in the text stands for
set shiftwidth=8 "number of spaces used for each step of (auto)indent
set softtabstop=8  "if non-zero, number of spaces to insert for a <Tab>
set noexpandtab
set nosmarttab "a <Tab> in an indent inserts 'shiftwidth' spaces
set textwidth=80
" linux kernel coding style
let g:clang_format#code_style='llvm'
let g:clang_format#style_options = {
            \ 'IndentWidth' : '8',
            \ 'UseTab' : 'Always',
            \ 'BreakBeforeBraces' : 'Linux',
            \ 'AllowShortIfStatementsOnASingleLine': 'false',
	    \ 'AllowShortBlocksOnASingleLine': 'false',
	    \ 'AllowShortCaseLabelsOnASingleLine': 'false',
	    \ 'AllowShortFunctionsOnASingleLine': 'None',
	    \ 'AllowShortLoopsOnASingleLine': 'false',
            \ 'IndentCaseLabels' : 'false'}

original c code:

struct test_t var = {
        .a=2,
        .c=3,
};

after clang-format:

struct test_t var = {
    .a = 2, .c = 3,
};

As showing above, when using this type of structure initialize, the indent is not correct after clang-format.

rhysd commented

Could you ensure that this is a problem of vim-clang-format, not clang-format itself?

Please try the config with command line and check the result by cli is what you intended.

Sorry for commenting even though it's closed, but I'd like to know if @tracyone found a solution.
Thanks.

@antoyo it is a issue of clang-format and i haven't found a solution yet.