Fixed #531: Error in cite compl. of thebibliography

This commit is contained in:
Karl Yngve Lervåg 2016-08-25 09:34:06 +02:00
parent 8d75f01cdd
commit 7244f48322

View File

@ -198,16 +198,19 @@ function! s:bib.search(regexp) dict " {{{2
" Find data from 'thebibliography' environments " Find data from 'thebibliography' environments
let lines = readfile(b:vimtex.tex) let lines = readfile(b:vimtex.tex)
if match(lines, '\C\\begin{thebibliography}') >= 0 if match(lines, '\C\\begin{thebibliography}') >= 0
for line in filter(filter(lines, 'v:val =~# ''\C\\bibitem'''), for line in filter(filter(lines,
\ 'v:val =~# ''\C\\bibitem'''),
\ 'v:val =~ a:regexp') \ 'v:val =~ a:regexp')
let match = matchlist(line, '\\bibitem{\([^}]*\)')[1] let matches = matchlist(line, '\\bibitem\(\[[^]]\]\)\?{\([^}]*\)')
call add(res, { if len(matches) > 1
\ 'key': match, call add(res, {
\ 'type': '', \ 'key': matches[2],
\ 'author': '', \ 'type': '',
\ 'year': '', \ 'author': '',
\ 'title': match, \ 'year': '',
\ }) \ 'title': matches[2],
\ })
endif
endfor endfor
endif endif