Cf. #590: Add fold text and improve fold detect

This commit is contained in:
Karl Yngve Lervåg 2016-10-17 22:49:18 +02:00
parent 4f829fe694
commit d023d776a5

View File

@ -49,7 +49,7 @@ function! vimtex#fold#init_script() " {{{1
let s:folded .= ' ^\s*\%'
let s:folded .= '|^\s*\]\{'
let s:folded .= '|^\s*}\s*$'
let s:folded .= '|\%\s*%(\{\{\{|}}})'
let s:folded .= '|\%%(.*\{\{\{|\s*}}})'
let s:folded .= '|\\%(' . join([
\ 'begin',
\ 'end',
@ -213,7 +213,7 @@ function! vimtex#fold#level(lnum) " {{{1
endif
" Fold markers
if line =~# '%\s*{{{'
if line =~# '%.*{{{'
return 'a1'
elseif line =~# '%\s*}}}'
return 's1'
@ -303,6 +303,12 @@ function! vimtex#fold#text() " {{{1
\ . '}'
endif
if line =~# '%\s*{{{'
return ' ' . matchstr(line, '%\s*{{{\s*\zs.*')
elseif line =~# '%.*{{{'
return ' ' . matchstr(line, '%\s*\zs.*\ze{{{')
endif
" Text for newcommand (and similar)
if g:vimtex_fold_newcommands
\ && line =~# '\v^\s*\\%(re)?new%(command|environment)'