Fix #319 - Fold bibliographies
This commit is contained in:
parent
ab8d7ffc45
commit
97927e65f9
@ -106,7 +106,7 @@ function! vimtex#fold#level(lnum) " {{{1
|
||||
|
||||
" Check for normal lines first (optimization)
|
||||
let line = getline(a:lnum)
|
||||
if line !~# '^\s*%\|\\\%(document\|begin\|end\|'
|
||||
if line !~# '^\s*%\|\\\%(document\|begin\|end\|printbibliography\|'
|
||||
\ . 'front\|main\|back\|app\|sub\|section\|chapter\|part\)'
|
||||
return '='
|
||||
endif
|
||||
@ -199,6 +199,9 @@ function! s:refresh_folded_sections()
|
||||
let b:vimtex_fold_parts = []
|
||||
endif
|
||||
|
||||
" Set bibliography fold level
|
||||
let biblevel = level + 1
|
||||
|
||||
" Parse section commands (chapter, [sub...]section)
|
||||
let lines = filter(copy(buffer), 'v:val =~ ''' . s:secs . '''')
|
||||
for part in g:vimtex_fold_sections
|
||||
@ -211,6 +214,9 @@ function! s:refresh_folded_sections()
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
|
||||
" Add bibliography pattern
|
||||
call insert(b:vimtex_fold_parts, ['^\s*\\printbibliography', biblevel])
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
@ -235,6 +241,8 @@ function! vimtex#fold#text() " {{{1
|
||||
let title = 'Backmatter'
|
||||
elseif line =~# '\\appendix'
|
||||
let title = 'Appendix'
|
||||
elseif line =~# '\\printbibliography'
|
||||
let title = 'Bibliography'
|
||||
elseif line =~# secpat1 . '.*}'
|
||||
let title = matchstr(line, secpat1 . '\zs.*\ze}')
|
||||
elseif line =~# secpat1
|
||||
|
Loading…
x
Reference in New Issue
Block a user