A. S. Budden wrote:
> 2009/3/12 Ben Schmidt <[email protected]>:
>>> 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:indentexpr='MyCindent(v:lnum)'
>> :setlocal cinkeys+=}
>>
>> Ben.
> 
> This looks really good, thank you!  Is there any way to make it indent
> when the '}' is typed?  I thought that this should happen with
> 
> :setlocal cinkeys+=}

Yeah, that was my intention...But that would work for cindent, not
indentexpr. :-) So we really want

:setlocal indentkeys+=}

or perhaps

:let &l:indentkeys = &l:cinkeys

is better, as indentkeys by default may not have the other stuff we want
for C-indenting in it.

Ben.




--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to