Vim indents C# enum incorrectly

Status
Not open for further replies.
I have a .cs file I am editing in Vim 7.3 on Fedora 17.

To get Vim to automatically indent the file, I type

<ESC>ggVG=

and everything is indented fine except for the enum blocks. I get code that looks like this:

Code:
namespace Foo
{
	public enum Bar
	{
		tInvalid,
			tInt32,
			tBoolean,
			tString,
	}
}

instead of

Code:
namespace Foo
{
	public enum Bar
	{
		tInvalid,
		tInt32,
		tBoolean,
		tString,
	}
}

What do I do to fix this? Googling for "vim enum indent" has not gotten me very far.
 

Vagrant

Ars Centurion
211
Subscriptor++
It looks like the default c-indent sees the enumeration values as a continuing statement for some reason I don't see. Removing the public keyword makes it indent as expected, but that obviously wasn't your intent.

As a workaround, you can ":set cinoptions+=+0" to not indent continuation lines. This workaround might be more annoying to you than the default behaviour, though.
 
Status
Not open for further replies.