Monday, May 27, 2024

Re: Adapting swich-case indentation

Hi radl...,

On Monday, 2024-05-27 15:06:51 -0700, radl...@gmail.com 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 vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/ZlUa6oIb4TJNoKQZ%40kulungile.erack.de.

No comments:

Post a Comment