>>> 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
Don't know why the unindenting seemed to be necessary before, but it
did. Maybe I'd left out a semicolon or something yielding extra indent
that I didn't want.
Ben.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---