From a23e86508cfcfbbf8dbbc375c821182abb5840fe Mon Sep 17 00:00:00 2001 From: Gerd Wachsmuth Date: Fri, 3 Feb 2017 20:23:56 +0100 Subject: [PATCH] Add support for bibfiles for old citecompletion Does anybody still use this old completion? --- ftplugin/latex-suite/texviewer.vim | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ftplugin/latex-suite/texviewer.vim b/ftplugin/latex-suite/texviewer.vim index af003bc..7a0e74f 100644 --- a/ftplugin/latex-suite/texviewer.vim +++ b/ftplugin/latex-suite/texviewer.vim @@ -380,11 +380,13 @@ function! s:Tex_CompleteRefCiteCustom(type) let prefixlength=strlen(s:prefix) if a:type =~ 'cite' - if getline('.') =~ '\\bibitem\s*{' - let bibkey = matchstr(getline('.'), '\\bibitem\s*{\zs.\{-}\ze}') - else - let bibkey = matchstr(getline('.'), '\\bibitem\s*\[.\{-}\]\s*{\zs.\{-}\ze}') + " Look for a '\bibitem' + let bibkey = matchstr(getline('.'), '\\bibitem\s*\%(\[.\{-}\]\)\?\s*{\zs.\{-}\ze}') + if bibkey == "" + " Look for a '@article{bibkey,' + let bibkey = matchstr(getline('.'), '@\w*{\zs\w*\ze,') endif + let completeword = bibkey elseif a:type =~ 'ref'