tags:

views:

91

answers:

1

I am currently using vim as my editor for programming in D. The indent rules are pretty much identical to C, but I've run into a case that vim doesn't handle by default. In D, case statements can take strings which are not properly handled by cindent.

For instance, this works:

switch(blah)
{
case 1:
    // something
case some_variable:
    // ...
}

But not this:

switch(blah)
{
    case "yark":
        case "flurb":
    // something
    case "...":
        // ...
}

Is there some way to override that single rule in a custom indent file, or would the entire cindent ruleset have to be reimplemented?

+4  A: 

Try Vim 7.3. The indentation rules introduced in this version mainly for JavaScript also fix this particular situation.

With Vim 7.3 the code is correctly indented as:

switch(blah)
{
    case "yark":
    case "flurb":
        // something
    case "...":
        // ...
}
rq
Thanks, that worked perfectly!
Dave B