Minor update to folding
This commit is contained in:
parent
97de910258
commit
bbf75bd35d
@ -36,6 +36,21 @@ function! vimtex#fold#init_script() " {{{1
|
|||||||
let s:secs = '\v^\s*(\\|\% Fake)(' . join(g:vimtex_fold_sections, '|') . ')>'
|
let s:secs = '\v^\s*(\\|\% Fake)(' . join(g:vimtex_fold_sections, '|') . ')>'
|
||||||
let s:notbslash = '\%(\\\@<!\%(\\\\\)*\)\@<='
|
let s:notbslash = '\%(\\\@<!\%(\\\\\)*\)\@<='
|
||||||
let s:notcomment = '\%(\%(\\\@<!\%(\\\\\)*\)\@<=%.*\)\@<!'
|
let s:notcomment = '\%(\%(\\\@<!\%(\\\\\)*\)\@<=%.*\)\@<!'
|
||||||
|
|
||||||
|
"
|
||||||
|
" List of identifiers for improving efficiency
|
||||||
|
"
|
||||||
|
let s:folded = '\v^\s*\%'
|
||||||
|
let s:folded .= '|\\%(' . join([
|
||||||
|
\ 'begin',
|
||||||
|
\ 'end',
|
||||||
|
\ '%(sub)*%(section|paragraph)',
|
||||||
|
\ 'chapter',
|
||||||
|
\ 'document',
|
||||||
|
\ '%(front|main|back)matter',
|
||||||
|
\ 'appendix',
|
||||||
|
\ 'part',
|
||||||
|
\ ], '|') . ')'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" }}}1
|
" }}}1
|
||||||
@ -111,10 +126,7 @@ function! vimtex#fold#level(lnum) " {{{1
|
|||||||
|
|
||||||
" Check for normal lines first (optimization)
|
" Check for normal lines first (optimization)
|
||||||
let line = getline(a:lnum)
|
let line = getline(a:lnum)
|
||||||
if line !~# '\v^\s*\%|\\%(document|begin|end|%(front|main|back)matter'
|
if line !~# s:folded | return '=' | endif
|
||||||
\ . '|appendix|part|chapter|%(sub)*%(section|paragraph))'
|
|
||||||
return '='
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Fold preamble
|
" Fold preamble
|
||||||
if g:vimtex_fold_preamble
|
if g:vimtex_fold_preamble
|
||||||
|
Loading…
x
Reference in New Issue
Block a user