vim-clang-format icon indicating copy to clipboard operation
vim-clang-format copied to clipboard

Specify ContinuationIndentWidth as 2*IndentWidth

Open tejasvi opened this issue 3 years ago • 2 comments
trafficstars

Most styles use ContinuationIndentWidth = 2*IndentWidth (google, llvm, etc). With existing arguments, shiftwidth=4 gives

constexpr operator To() const
    noexcept(noexcept(static_cast≺To≻(ːdeclval≺From≻()))) ⇉
    return static_cast≺To≻(val)

instead of expected

constexpr operator To() const
        noexcept(noexcept(static_cast≺To≻(ːdeclval≺From≻()))) ⇉
    return static_cast≺To≻(val)

tejasvi avatar Jan 26 '22 10:01 tejasvi

I think it should be set with g:clang_format#style_options rather than setting it always. How about the following configuration?

let g:clang_format#style_options = {
            \ 'ContinuationIndentWidth' : '8',
            \ }

rhysd avatar Feb 03 '22 15:02 rhysd

It would work, but I'd like to propose better defaults and OOTB experience. Currently behavior deviates from the expected indentation for g:clang_format#code_style since it overrides IndentWidth but not ContinuationIndentWidth. Feel free to close this one, I am fine either way.

tejasvi avatar Feb 04 '22 02:02 tejasvi