Does anyone know how to get #vim or #neovim's C and C++ indenter to indent switch statements sanely? I don't want this sort of alignment at all, and I certainly don't want it to align with a mix of tabs and spaces
@mort set expandtab option to avoid hard tabs. As for the indent style, this is governed by cindent option, but you probably already have a non default value for it coming from somewhere because it doesn't behave like this by default.
@VZ But I want hard tabs, the problems here are 1) the use of spaces and 2) the fact that it tries to align.
And no, this is the default behavior. Here's the result of typing in similar code with 'nvim --clean' followed by ':syntax on', ':set ft=c' and ':set cindent'.
Note that it doesn't indent like this without the inner braces. However, the inner braces are necessary due to the variable declaration, which you can't do in case bodies unless you introduce a block
@mort@VZ I don't do c/c++ buy I think cindent if too opignated, and certainly influenced by the bonkers "gnu" style. You might not want to enable it and instead find a more reasonable plugin to handle that.
Add comment