2009/3/12 Ben Schmidt <[email protected]>:
>
>>>> 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 seem quite right when used with real code. Perhaps
> this is better:
>
> func! MyCindent(l)
>   let extra = match(getline(a:l),'^\s*{.*}$')==-1?0:&sw
>   " let extra -= match(getline(prevnonblank(a:l-1)),'^\s*{.*}$')==-1?0:&sw
>   return cindent(a:l)+extra
> endfunc
> setlocal indentexpr=MyCindent(v:lnum)
> setlocal cinkeys+=}
> let &l:indentkeys=&l:cinkeys

This looks fantastic, thank you so much!

Al

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

Reply via email to