>>Might be academic at this point, but for a single *statement* (not line)
>>following a for(), if(), while(), etc., enclosing braces are *not*
>>required. So
>I realise this, but all C software that I write must be compliant with
>the MISRA-C guidelines for the use of the C language in critical
2009/3/12 Ben Schmidt :
>
func! MyCindent(l)
let extra = match(getline(prevnonblank(a:l-1)),'^\s*{.*}$')==-1?0:-&sw
let extra += match(getline(a:l),'^\s*{.*}$')==-1?0:&sw
return cindent(a:l)+extra
endfunc
:let &l:indentexpr='MyCindent(v:lnum)'
:setlocal cin
>>> func! MyCindent(l)
>>> let extra = match(getline(prevnonblank(a:l-1)),'^\s*{.*}$')==-1?0:-&sw
>>> let extra += match(getline(a:l),'^\s*{.*}$')==-1?0:&sw
>>> return cindent(a:l)+extra
>>> endfunc
>>> :let &l:indentexpr='MyCindent(v:lnum)'
>>> :setlocal cinkeys+=}
Hmm. It still doesn't se
A. S. Budden wrote:
> 2009/3/12 Ben Schmidt :
>>> Yes, but it's clearer (to me) than
>>>
>>> for (;;)
>>> {CallFunction();}
>> It looks like you resort to:
>>
>> func! MyCindent(l)
>> let extra = match(getline(prevnonblank(a:l-1)),'^\s*{.*}$')==-1?0:-&sw
>> let extra += match(getline(a:l),'^\s
2009/3/12 Ben Schmidt :
>
>> Yes, but it's clearer (to me) than
>>
>> for (;;)
>> {CallFunction();}
>
> It looks like you resort to:
>
> func! MyCindent(l)
> let extra = match(getline(prevnonblank(a:l-1)),'^\s*{.*}$')==-1?0:-&sw
> let extra += match(getline(a:l),'^\s*{.*}$')==-1?0:&sw
> retu
2009/3/11 Gene Kwiecinski :
>
>>>His indentation of opening braces is inconsistent.
>
>>Yes, but it's clearer (to me) than
>>for (;;)
>>{CallFunction();}
>
> Might be academic at this point, but for a single *statement* (not line)
> following a for(), if(), while(), etc., enclosing braces are *not
> Yes, but it's clearer (to me) than
>
> for (;;)
> {CallFunction();}
It looks like you resort to:
func! MyCindent(l)
let extra = match(getline(prevnonblank(a:l-1)),'^\s*{.*}$')==-1?0:-&sw
let extra += match(getline(a:l),'^\s*{.*}$')==-1?0:&sw
return cindent(a:l)+extra
endfunc
:let &l:
On Mar 11, 11:16 am, "Gene Kwiecinski" wrote:
>
> Ooh.. Quick example: Why bother with a rather ghastly
>
>
>
>
> Caution
>
>
>
>
>>His indentation of opening braces is inconsistent.
>Yes, but it's clearer (to me) than
>for (;;)
>{CallFunction();}
Might be academic at this point, but for a single *statement* (not line)
following a for(), if(), while(), etc., enclosing braces are *not*
required. So
for(;;)
On Mar 11, 1:47 am, Gary Johnson wrote:
>
> I don't think there's any way to use those options to do what he
> wants to do, though. His indentation of opening braces is
> inconsistent.
>
Yeah, I guess not.
Looks like it is time to write your own function for use in an
indentexpr. You can ha
2009/3/11 Gary Johnson :
>
> On 2009-03-10, Ben Fritz wrote:
>> On Mar 10, 10:02 am, "A. S. Budden" wrote:
>>
>>
>> > I was wondering whether it is possible to make a (minor) change to the
>> > indent style used for C code. Generally I like the style and I don't
>> > want to change much. The on
On 2009-03-10, Ben Fritz wrote:
> On Mar 10, 10:02 am, "A. S. Budden" wrote:
>
>
> > I was wondering whether it is possible to make a (minor) change to the
> > indent style used for C code. Generally I like the style and I don't
> > want to change much. The only exception that I'd like to add
On Mar 10, 10:02 am, "A. S. Budden" wrote:
> I was wondering whether it is possible to make a (minor) change to the
> indent style used for C code. Generally I like the style and I don't
> want to change much. The only exception that I'd like to add is such
> that the following code is inde
A. S. Budden 写道:
> for (;;)
> {
> /* This is indented correctly: I don't want to change this */
> CallFunction1();
> CallFunction2();
> }
>
> for (;;)
> {CallFunction();} /* This is what I'd like to support for single
> lines with open and close braces */
>
> for (;;)
> {CallFunc
14 matches
Mail list logo