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
let lines = readfile(b:vimtex.tex)
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')
let match = matchlist(line, '\\bibitem{\([^}]*\)')[1]
let matches = matchlist(line, '\\bibitem\(\[[^]]\]\)\?{\([^}]*\)')
if len(matches) > 1
call add(res, {
\ 'key': match,
\ 'key': matches[2],
\ 'type': '',
\ 'author': '',
\ 'year': '',
\ 'title': match,
\ 'title': matches[2],
\ })
endif
endfor
endif