vimtex/autoload/toc.vim

38 lines
713 B
VimL
Raw Normal View History

2014-07-22 18:08:57 -04:00
" LaTeX plugin for Vim
"
" Maintainer: Karl Yngve Lervåg
" Email: karl.yngve@gmail.com
"
function! toc#fold_level(lnum) " {{{1
let pline = getline(a:lnum - 1)
let cline = getline(a:lnum)
let nline = getline(a:lnum + 1)
2014-07-20 09:59:20 -04:00
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
2014-07-20 09:59:20 -04:00
if l:nn > l:cn && g:latex_toc_fold_levels >= l:nn
return '>' . l:nn
endif
2014-07-20 09:59:20 -04:00
if l:cn < l:pn && l:cn >= l:nn && g:latex_toc_fold_levels >= l:cn
return l:cn
endif
return '='
2013-10-05 07:53:42 -04:00
endfunction
function! toc#fold_text() " {{{1
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