mort,
@mort@fosstodon.org avatar

Does anyone know how to get or '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

#C

gracicot,
@gracicot@mastodon.social avatar

@mort Clang format keep trying to align the inside of blocks sometimes. It drives me crazy. Who wants to read code that starts at column 70??

VZ,
@VZ@fosstodon.org avatar

@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.

mort,
@mort@fosstodon.org avatar

@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

tshirtman, (edited )
@tshirtman@mas.to avatar

@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.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • vim
  • kavyap
  • thenastyranch
  • cubers
  • ethstaker
  • InstantRegret
  • DreamBathrooms
  • ngwrru68w68
  • magazineikmin
  • everett
  • Youngstown
  • mdbf
  • slotface
  • rosin
  • GTA5RPClips
  • JUstTest
  • khanakhh
  • normalnudes
  • osvaldo12
  • cisconetworking
  • provamag3
  • Durango
  • tacticalgear
  • modclub
  • Leos
  • megavids
  • tester
  • anitta
  • lostlight
  • All magazines