tags:

views:

34

answers:

1

I'm using vim to edit files that use a programming language where the end of line is not marked with ;. This causes problems when I try to fix indentation in vim. If I put a ; at the end then vim is able to correctly fix the indentation, but since this programming language doesn't have a ; at the end of a statement the indentation isn't correct after vim tries to fix it.

Here is the code correctly formatted:

if imageFound("foo.bmp")
{
    clickButton("button1.bmp")
    clickButton("button2.bmp")
}

If I do =G then in will turn into this, which is incorrectly formatted:

if imageFound("foo.bmp")
{
    clickButton("button1.bmp")
        clickButton("button2.bmp")
}

However, if I put a ; at the end of one of the lines the line underneath it will be correctly formatted.

if imageFound("foo.bmp")
{
    clickButton("button1.bmp");
    clickButton("button2.bmp")
}

How can I make vim correctly fix the formatting without having to put a ; at the end of lines?

+1  A: 

:set cindent cinoptions=+0.

sreservoir