32 lines
617 B
VimL
32 lines
617 B
VimL
function! toc#fold_level(lnum) " {{{1
|
|
let pline = getline(a:lnum - 1)
|
|
let cline = getline(a:lnum)
|
|
let nline = getline(a:lnum + 1)
|
|
let l:pn = matchstr(pline, '\d$')
|
|
let l:cn = matchstr(cline, '\d$')
|
|
let l:nn = matchstr(nline, '\d$')
|
|
|
|
" Don't fold options
|
|
if cline =~# '^\s*$'
|
|
return 0
|
|
endif
|
|
|
|
if l:nn > l:cn && g:latex_toc_fold_levels >= l:nn
|
|
return '>' . l:nn
|
|
endif
|
|
|
|
if l:cn < l:pn && l:cn >= l:nn && g:latex_toc_fold_levels >= l:cn
|
|
return l:cn
|
|
endif
|
|
|
|
return '='
|
|
endfunction
|
|
|
|
function! toc#fold_text() " {{{1
|
|
return getline(v:foldstart)
|
|
endfunction
|
|
|
|
" }}}1
|
|
|
|
" vim: fdm=marker
|