Thursday, May 22, 2014

Indentation after case statement

Hi all,

I'm trying to get vim to play nicely with GTK's coding style[1] by
setting cinoptions but I can't figure out what to use for case
statements.

Desired (according to the coding style):

switch (x)
{
case 1:
{
foo();
}
case 2:
bar();
}

A) What I get with "setlocal et sw=2 cinoptions=>4,n-2,{2":
(note the large indent after case 1)

switch (x)
{
case 1:
{
foo();
}
case 2:
bar();
}

B) What I get with "setlocal et sw=2 cinoptions=>4,n-2,{2,=0":
(note no indent after case 2)

switch (x)
{
case 1:
{
foo();
}
case 2:
bar();
}

Is there some combination of cinoptions that can get the desired
indentation automatically?

[1]: https://git.gnome.org/browse/gtk+/plain/docs/CODING-STYLE

Thanks
--
Ross Lagerwall

--
--
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.
For more options, visit https://groups.google.com/d/optout.

No comments: