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;
}
}
}
The above example illustrates what I want:. But when I visual-select those lines and press =. I get this:
int main() {
int n = 42;
switch (n) {
case 42: {
int twice = 2*n;
}
}
The compiler insists on the braces because of that local int twice variable; putting the opening brace of the case: on its own line helps, but then I have a deviation from my preferred style.
Please note that this example is contrived to illustrate the problem, not an excerpt from an actual program..
Am I just finally asking too much of Vim?