Monday, October 11, 2010

Re: Re: cindent with a "semi-c-style" language

Den6 okt 2010 20:42, skrevGustaf Johansson <gustaf.j@gmail.com>:
> On Wed, Oct 6, 2010 at 12:53 AM, Benjamin R. Haskell vim@benizi.com> wrote:
>
> > On Tue, 5 Oct 2010, Gustaf Johansson wrote:
>
> >
>
> >> Hi,
>
> >>
>
> >> I am trying to get cindent to successfully indent a "semi-c-style"
>
> >> language.  It has all the standard constructions and the cindent feature
>
> >> works quite well for most cases.  But the language uses := as assignment
>
> >> operator, and this causes problems with cindent.  cindent always positions
>
> >> these statements at column 0, i have tried to change cinoptions without
>
> >> success.  I suppose cindent thinks that these lines are labels of some kind.
>
> >>
>
> >> So my question is: is it possible to disable cindent's recognition of
>
> >> labels (the language does not have any anyway).
>
> >
>
> > I think:
>
> >
>
> > set cinoptions+=L0
>
> >
>
> > should do what you want.  (It appears to work in an actual C file.)
>
> >
>
> > Found in:
>
> >
>
> > :help C-indenting
>
> >
>
> > by searching for ':' (no quotes), and finding:
>
> >
>
> > LN    Controls placement of jump labels. [...]
>
> >
>
> > The default is equivalent to L-1, to place at column 1.  (Vim columns start
>
> > at 1, not 0)
>
> >
>
> > --
>
> > Best,
>
> > Ben
>
>
>
> Thanks Ben,
>
>
>
> I was using vim 7.2 so i was missing this option (was added in 7.3).
>
>
>
> BR Gustaf
>

This works fine for the statement with the assignment ':=', but does not solve the problem for the next statement.
Example i get this behaviour when using L0:

{
foo := bar;
foobar;
}

The correct behavior (in my case, but thats what i would want in C/C++ code as well, with the exception of the label at position 0):
{
foo := bar;
foobar;
}

BR Gustaf

--
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

No comments: