My cinoptions is the folowing :
:set cinoptions={1s,t0,f0s,g0,i0,(0,=0
it works well with brace contained case statement, but not unbraced one :
switch(foo)
{
case(0):
{
...
break;
}
case(1):
... <-- should be indented
break;
}
i need the {1s for all my code need to be formated like that, if i drop the =0 i get this.
switch(foo)
{
case(0):
{
... <-- should not be idented so much
break;
}
case(1):
...
break;
}
Is there any way to specify vim not to indent case in any special way ?
Finaly done it myself, using a in house indent method :
function Indent(line)
" Store current pos
let l:indent = cindent(a:line)
let l:lineprec = a:line - 1
let l:linefirst = split(getline(a:line), " ")[0]
if l:linefirst ==# "{"
let l:case = split(getline(l:lineprec), " ")[0]
if l:case ==# "case"
let l:indent = indent(l:lineprec) + &shiftwidth
endif
endif
return l:indent
endfunction
add in .vimrc :
:set indentexpr=Indent(line(\".\"))
it's kinda specific to my coding style ( case must be followed by a space )