From 2479aaa37c21ae6284b88633a2f6d3102f629477 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Yngve=20Lerv=C3=A5g?= Date: Wed, 27 Jul 2016 10:01:06 +0200 Subject: [PATCH] Fix #502: Handle case where s:completer not defined --- autoload/vimtex/complete.vim | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/autoload/vimtex/complete.vim b/autoload/vimtex/complete.vim index 9ca600d..fda0611 100644 --- a/autoload/vimtex/complete.vim +++ b/autoload/vimtex/complete.vim @@ -37,6 +37,8 @@ endfunction function! vimtex#complete#omnifunc(findstart, base) " {{{1 if a:findstart + if exists('s:completer') | unlet s:completer | endif + let l:pos = col('.') - 1 let l:line = getline('.')[:l:pos-1] for l:completer in s:completers @@ -59,7 +61,9 @@ function! vimtex#complete#omnifunc(findstart, base) " {{{1 endfor return -3 else - return s:close_braces(s:completer.complete(a:base)) + return exists('s:completer') + \ ? s:close_braces(s:completer.complete(a:base)) + \ : [] endif endfunction