mirror of
https://github.com/davidhalter/jedi-vim.git
synced 2025-12-06 10:54:22 +08:00
Fix restoring alternate terminal with completeopt redirection
Fixes https://github.com/davidhalter/jedi-vim/issues/721.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user