2014-07-15 08:52:45 -04:00
|
|
|
function! toc#fold_level(lnum) " {{{1
|
2014-07-20 09:51:13 -04:00
|
|
|
let pline = getline(a:lnum - 1)
|
|
|
|
let cline = getline(a:lnum)
|
|
|
|
let nline = getline(a:lnum + 1)
|
|
|
|
let pn = matchstr(pline, '\d$')
|
|
|
|
let cn = matchstr(cline, '\d$')
|
|
|
|
let nn = matchstr(nline, '\d$')
|
|
|
|
|
|
|
|
" Don't fold options
|
|
|
|
if cline =~# '^\s*$'
|
|
|
|
return 0
|
|
|
|
endif
|
|
|
|
|
|
|
|
if nn > cn
|
|
|
|
return '>' . nn
|
|
|
|
endif
|
|
|
|
|
|
|
|
if cn < pn && cn >= nn
|
|
|
|
return cn
|
|
|
|
endif
|
|
|
|
|
|
|
|
return '='
|
2013-10-05 07:53:42 -04:00
|
|
|
endfunction
|
|
|
|
|
2014-07-15 08:52:45 -04:00
|
|
|
function! toc#fold_text() " {{{1
|
2014-07-20 09:51:13 -04:00
|
|
|
return getline(v:foldstart)
|
2013-10-05 07:53:42 -04:00
|
|
|
endfunction
|
|
|
|
|
|
|
|
" }}}1
|
|
|
|
|
2014-02-10 08:21:43 -05:00
|
|
|
" vim: fdm=marker
|