diff --git a/plugin/jedi.vim b/plugin/jedi.vim index 6fe1bcc..485cdb7 100644 --- a/plugin/jedi.vim +++ b/plugin/jedi.vim @@ -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('', 'i')) == 0