Fix option g:latex_toc_fold_levels
This commit is contained in:
parent
fa66acf7fd
commit
910db68b44
@ -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_resize', 1)
|
||||||
call latex#util#set_default('g:latex_toc_hide_help', 0)
|
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', 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')
|
call latex#util#set_default('g:latex_viewer', 'xdg-open')
|
||||||
endfunction
|
endfunction
|
||||||
" }}}1
|
" }}}1
|
||||||
|
@ -2,21 +2,21 @@ function! toc#fold_level(lnum) " {{{1
|
|||||||
let pline = getline(a:lnum - 1)
|
let pline = getline(a:lnum - 1)
|
||||||
let cline = getline(a:lnum)
|
let cline = getline(a:lnum)
|
||||||
let nline = getline(a:lnum + 1)
|
let nline = getline(a:lnum + 1)
|
||||||
let pn = matchstr(pline, '\d$')
|
let l:pn = matchstr(pline, '\d$')
|
||||||
let cn = matchstr(cline, '\d$')
|
let l:cn = matchstr(cline, '\d$')
|
||||||
let nn = matchstr(nline, '\d$')
|
let l:nn = matchstr(nline, '\d$')
|
||||||
|
|
||||||
" Don't fold options
|
" Don't fold options
|
||||||
if cline =~# '^\s*$'
|
if cline =~# '^\s*$'
|
||||||
return 0
|
return 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if nn > cn
|
if l:nn > l:cn && g:latex_toc_fold_levels >= l:nn
|
||||||
return '>' . nn
|
return '>' . l:nn
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if cn < pn && cn >= nn
|
if l:cn < l:pn && l:cn >= l:nn && g:latex_toc_fold_levels >= l:cn
|
||||||
return cn
|
return l:cn
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return '='
|
return '='
|
||||||
|
Loading…
x
Reference in New Issue
Block a user