>>109240532
oh my, that mish-mash isnt classic
--
so hiya, retards, posting my AI generated C indentation:
" sm-c indentation {{{
function! SmCIndent()
let l:prev_line = getline(v:lnum - 1)
let l:prev_indent = indent(v:lnum - 1)
let l:curr_line = getline(v:lnum)
" Rule 0: Edge case - Empty body closure
" If previous line opens and current line closes, match the previous line's indent
if l:prev_line =~# '[\({]\s*$' && l:curr_line =~# '^\s*[\)}]'
return l:prev_indent
endif
" Rule 1: If the current line starts with a closing parenthesis or brace,
" drop back 1 shiftwidth, but never go below 0.
if l:curr_line =~# '^\s*[\)}]'
let l:target_indent = l:prev_indent - &shiftwidth
return l:target_indent < 0 ? 0 : l:target_indent
endif
" Rule 2: If the previous line ends with an unclosed opening parenthesis or brace
" Skip if the brace is preceded by a comment marker (// or #)
if l:prev_line =~# '[\({]\s*$' && l:prev_line !~# '\v(//|#).*[\({]'
return l:prev_indent + &shiftwidth
endif
" Default fallback: maintain previous line's indent level
return l:prev_indent
endfunction
augroup SmIndent
autocmd!
autocmd FileType c,h setlocal nocindent nosmartindent indentexpr=SmCIndent() indentkeys=0),0},0],:,0#,!^F,o,O
augroup END
" }}}