From 910db68b4412019a8dc61c97e92d9d8e21b7c54c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Yngve=20Lerv=C3=A5g?= Date: Sun, 20 Jul 2014 15:59:20 +0200 Subject: [PATCH] Fix option g:latex_toc_fold_levels --- autoload/latex.vim | 2 +- autoload/toc.vim | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/autoload/latex.vim b/autoload/latex.vim index 93ec533..baa90e3 100644 --- a/autoload/latex.vim +++ b/autoload/latex.vim @@ -260,7 +260,7 @@ function! s:init_options() " {{{1 call latex#util#set_default('g:latex_toc_resize', 1) call latex#util#set_default('g:latex_toc_hide_help', 0) call latex#util#set_default('g:latex_toc_fold', 0) - call latex#util#set_default('g:latex_toc_fold_levels', 0) + call latex#util#set_default('g:latex_toc_fold_levels', 10) call latex#util#set_default('g:latex_viewer', 'xdg-open') endfunction " }}}1 diff --git a/autoload/toc.vim b/autoload/toc.vim index 0c51d8d..fc92de0 100644 --- a/autoload/toc.vim +++ b/autoload/toc.vim @@ -2,21 +2,21 @@ function! toc#fold_level(lnum) " {{{1 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$') + 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 nn > cn - return '>' . nn + if l:nn > l:cn && g:latex_toc_fold_levels >= l:nn + return '>' . l:nn endif - if cn < pn && cn >= nn - return cn + if l:cn < l:pn && l:cn >= l:nn && g:latex_toc_fold_levels >= l:cn + return l:cn endif return '='