From f9f1dd5c2935730a69ab45f9f83a95a15e9e3f0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Yngve=20Lerv=C3=A5g?= Date: Sat, 10 Sep 2016 22:34:54 +0200 Subject: [PATCH] Cf. #531: Minor tweak to label complete caching --- autoload/vimtex/complete.vim | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/autoload/vimtex/complete.vim b/autoload/vimtex/complete.vim index 752a831..36dfe7c 100644 --- a/autoload/vimtex/complete.vim +++ b/autoload/vimtex/complete.vim @@ -247,6 +247,7 @@ let s:ref = { \ '\\hyperref\s*\[[^]]*$' \ ], \ 'cache' : {}, + \ 'labels' : [], \} function! s:ref.complete(regex) dict " {{{2 @@ -297,11 +298,15 @@ function! s:ref.get_matches(regex) dict " {{{2 endfunction function! s:ref.parse_aux_files() dict " {{{2 - let self.labels = [] + let l:aux = b:vimtex.aux() + if empty(l:aux) + return self.labels + endif - for [l:file, l:prefix] in - \ filter([[b:vimtex.aux(), '']] - \ + map(vimtex#parser#get_externalfiles(), '[v:val.aux, v:val.opt]'), + let self.labels = [] + for [l:file, l:prefix] in [[l:aux, '']] + \ + filter(map(vimtex#parser#get_externalfiles(), + \ '[v:val.aux, v:val.opt]'), \ 'filereadable(v:val[0])') let l:cached = get(self.cache, l:file, {})