Fix #503: Handle \eqref as \ref{eq:

This commit is contained in:
Karl Yngve Lervåg 2016-07-28 19:33:05 +02:00
parent d2d8115e39
commit 930659bc5e

View File

@ -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