Indentation of C/C++ code is typically done by enabling the 'cindent' option (built-in to Vim), which is in turn controlled by options set in 'cinoptions'.
There are two interesting settings in 'cinoptions' that somewhat do what you want.
The first is :set cinoptions==0, which instructs Vim to not indent the block under a case statement. So you do get this effect:
case a:
{
y();
break;
}
On the downside, when you don't use a block starting with {, then what you get is:
case a:
y();
break;
Which looks wrong...
Then there's :set cinoptions=l1, which doesn't do exactly what you described here, but on the other hand it works well for when the { is opened on the same line as the case statement.
So you get:
case a: {
y();
break;
}
And if you omit the braces, then you get:
case a:
y();
break;
But unfortunately it doesn't help in the case where the { is opened on a line of its own, below the case statement.
These two options affect case statements exclusively, so they don't affect any other { blocks connected to any other statements (I see you found :set cino={-s but that affects the {s elsewhere.)
It's theoretically possible to get exactly what you need by writing an indentation function and setting 'indentexpr' (instead of using the built-in 'cindent'), but this would require you to write Vimscript to essentially reimplement all the built-in features of 'cindent' as well, which would surely be a herculean task... Probably best is to settle for one of the options above, or perhaps manually fix the indentation (with Ctrl+D and similar keystrokes) when you use blocks inside case statements, particularly if you don't do it too often.
:set cino+==0will suffice. If you sometimes use bare statements though, you're going to need a customindentexprlike the accepted answer (but which solves that one's issues): I don't think it's possible with simple tweaks to'cinoptions'. – Rich Sep 15 '20 at 15:50:set cino+==0it works for me :) – Sep 15 '20 at 16:14