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