Re: Adapting swich-case indentation

Eike Rathke <[email protected]>
Newsgroups gmane.editors.vim
Message-ID <[email protected]>
Hi radl...,

On Monday, 2024-05-27 15:06:51 -0700, [email protected] wrote:

> Is there a way to bend Vim to my will in indenting C switch-case statements 
> with local scopes delimited by braces.  Here's what I mean: (Vim 9.1 on 
> MacOS (M2 chip and Intel x86-64)  
> int main() {
>     int n = 42;
>     switch (n) {
>         case 42: {
>             int twice = 2*n;
>         }        
>     }
> }

Play with the cinoptions values, see :h 'cinoptions-values'

Adding l1 should suit your case. So
:set cinoptions=l1
if you don't have other values already.

  Eike

-- 
OpenPGP/GnuPG encrypted mail preferred in all private communication.
GPG key 0x6A6CD5B765632D3A - 2265 D7F3 A7B0 95CC 3918  630B 6A6C D5B7 6563 2D3A
Use LibreOffice! https://www.libreoffice.org/

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/ZlUa6oIb4TJNoKQZ%40kulungile.erack.de.
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEImXX86ewlcw5GGMLamzVt2VjLToFAmZVGuUACgkQamzVt2Vj
LTq5ShAAmTqhfS8kLyfjuldZI2QEZoAJwUuIQPrCdTPAGsNFdKD32WLW9ciKYMLh
wEL0WsJrpgT1RUX3UWe0CaWtM8yaR0+xj9vMtRH5oZHH5pMz3X1WejxjeLTJrNdt
SwDbwStQEu95iOpLHT+G+57SMHLAjUfGAOI5Qsny6pv6Sna+HJOhMog2Cio5HuuK
4aYZ9IbVcRHJ9+Hr2Cm34FYMcJD/Eot54WGrol4MHFZPfHxEARNHsICN8sTxvwEI
PwfSdnjFiO7gIL8fd/+1LV17TSsk0fS9tr9zzFKiJWfTjEUtuQLZlzlm1547TavU
lKU4d2JrGHZrjNQGNcUNOVMEmwD6SsEqIdrh4EkD07JR0nRDvyWEAg/XJHW/j1vR
/uaeXRFdyjH0r4iWsCJz0SMRxduHGL4fzrwOtTTn9Xo/DNZqiwcwF9maM4m39GBv
gltnvhtm2aEIoRjygudeMKMYusBKoh6otzPueWdLkS5ga/ZT+FubERXnMVms6zmk
DZny501NUkgC1TU1XHyma5dHvnfNI90ln/R9RSk+khYSZ9mdFeQ2uzEpFuQhRn4l
jaV81qVfLAhGs9VBzx5hmAHk++913gxrmG3rBc2ji7PgDjvIsWnNltRddcO7DVj5
ItVAWkI1260JHkI6hFoLfr2HNPe14evxdH6Q4TfveF+CMfhwWDY=
=x/+t
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.