From 930659bc5ed2a17996af58b99bc866974b97b2c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Yngve=20Lerv=C3=A5g?= Date: Thu, 28 Jul 2016 19:33:05 +0200 Subject: [PATCH] Fix #503: Handle \eqref as \ref{eq: --- autoload/vimtex/complete.vim | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/autoload/vimtex/complete.vim b/autoload/vimtex/complete.vim index fda0611..16fb5e7 100644 --- a/autoload/vimtex/complete.vim +++ b/autoload/vimtex/complete.vim @@ -50,6 +50,7 @@ function! vimtex#complete#omnifunc(findstart, base) " {{{1 while l:pos > 0 if l:line[l:pos - 1] =~# '{\|,\|\[' \ || l:line[l:pos-2:l:pos-1] ==# ', ' + let s:completer.context = matchstr(l:line, '\S*$') return l:pos else let l:pos -= 1 @@ -256,6 +257,14 @@ function! s:ref.complete(regex) dict " {{{2 \ }) endfor + " + " If context is 'eqref', then only show eq: labels + " + if self.context =~# '\\eqref' + \ && !empty(filter(copy(self.matches), 'v:val[0] =~# ''eq:''')) + call filter(self.candidates, 'v:val.word =~# ''eq:''') + endif + return self.candidates endfunction