forked from VimPlug/jedi-vim
Factor out jedi#setup_completion (#768)
This commit is contained in:
committed by
Dave Halter
parent
0b9bbc3495
commit
6d05c25873
@@ -1,23 +1,3 @@
|
||||
if !jedi#init_python()
|
||||
finish
|
||||
endif
|
||||
|
||||
if g:jedi#auto_initialization
|
||||
if g:jedi#completions_enabled
|
||||
" We need our own omnifunc, so this overrides the omnifunc set by
|
||||
" $VIMRUNTIME/ftplugin/python.vim.
|
||||
setlocal omnifunc=jedi#completions
|
||||
|
||||
" map ctrl+space for autocompletion
|
||||
if g:jedi#completions_command ==# '<C-Space>'
|
||||
" In terminals, <C-Space> sometimes equals <Nul>.
|
||||
imap <buffer> <Nul> <C-Space>
|
||||
smap <buffer> <Nul> <C-Space>
|
||||
endif
|
||||
if len(g:jedi#completions_command)
|
||||
execute 'inoremap <expr> <buffer> '.g:jedi#completions_command.' jedi#complete_string(0)'
|
||||
" A separate mapping for select mode: deletes and completes.
|
||||
execute 'snoremap <expr> <buffer> '.g:jedi#completions_command." '\<C-g>c'.jedi#complete_string(0)"
|
||||
endif
|
||||
endif
|
||||
if jedi#init_python() && g:jedi#auto_initialization && g:jedi#completions_enabled
|
||||
call jedi#setup_completion()
|
||||
endif
|
||||
|
||||
@@ -614,6 +614,24 @@ function! jedi#smart_auto_mappings() abort
|
||||
endfunction
|
||||
|
||||
|
||||
function! jedi#setup_completion() abort
|
||||
" We need our own omnifunc, so this overrides the omnifunc set by
|
||||
" $VIMRUNTIME/ftplugin/python.vim.
|
||||
setlocal omnifunc=jedi#completions
|
||||
|
||||
" map ctrl+space for autocompletion
|
||||
if g:jedi#completions_command ==# '<C-Space>'
|
||||
" In terminals, <C-Space> sometimes equals <Nul>.
|
||||
imap <buffer> <Nul> <C-Space>
|
||||
smap <buffer> <Nul> <C-Space>
|
||||
endif
|
||||
if len(g:jedi#completions_command)
|
||||
execute 'inoremap <expr> <buffer> '.g:jedi#completions_command.' jedi#complete_string(0)'
|
||||
" A separate mapping for select mode: deletes and completes.
|
||||
execute 'snoremap <expr> <buffer> '.g:jedi#completions_command." '\<C-g>c'.jedi#complete_string(0)"
|
||||
endif
|
||||
endfunction
|
||||
|
||||
"PythonJedi jedi_vim.jedi.set_debug_function(jedi_vim.print_to_stdout, speed=True, warnings=False, notices=False)
|
||||
"PythonJedi jedi_vim.jedi.set_debug_function(jedi_vim.print_to_stdout)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user