Fix restoring alternate terminal with completeopt redirection

Fixes https://github.com/davidhalter/jedi-vim/issues/721.
This commit is contained in:
Daniel Hahler
2017-08-07 20:34:10 +02:00
parent a46ea1a1eb
commit 82661d515b

View File

@@ -16,11 +16,28 @@ if get(g:, 'jedi#auto_vim_configuration', 1)
filetype plugin on
" Change completeopt, but only if it was not set already.
redir => completeopt
silent verb set completeopt?
redir END
if len(split(completeopt, '\n')) == 1
set completeopt=menuone,longest,preview
" This gets done on VimEnter, since otherwise Vim fails to restore the
" screen. Neovim is not affected, this is likely caused by using
" :redir/execute() before the (alternate) terminal is configured.
function! s:setup_completeopt()
if exists('*execute')
let completeopt = execute('silent verb set completeopt?')
else
redir => completeopt
silent verb set completeopt?
redir END
endif
if len(split(completeopt, '\n')) == 1
set completeopt=menuone,longest,preview
endif
endfunction
if has('nvim')
call s:setup_completeopt()
else
augroup jedi_startup
au!
autocmd VimEnter * call s:setup_completeopt()
augroup END
endif
if len(mapcheck('<C-c>', 'i')) == 0