Debian Codegraph @

vim/plugin/jedi.vim

raw
1 "jedi-vim - Omni Completion for python in vim
2 " Maintainer: David Halter <[email protected]>
3 "
4 " This part of the software is just the vim interface. The really big deal is
5 " the Jedi Python library.
6
7 if get(g:, 'jedi#auto_vim_configuration', 1)
8 " jedi-vim doesn't work in compatible mode (vim script syntax problems)
9 if &compatible
10 " vint: -ProhibitSetNoCompatible
11 set nocompatible
12 " vint: +ProhibitSetNoCompatible
13 endif
14
15 " jedi-vim really needs, otherwise jedi-vim cannot start.
16 filetype plugin on
17
18 augroup jedi_pyi
19 au!
20 autocmd BufNewFile,BufRead *.pyi set filetype=python
21 augroup END
22
23 " Change completeopt, but only if it was not set already.
24 " This gets done on VimEnter, since otherwise Vim fails to restore the
25 " screen. Neovim is not affected, this is likely caused by using
26 " :redir/execute() before the (alternate) terminal is configured.
27 function! s:setup_completeopt()
28 if exists('*execute')
29 let completeopt = execute('silent verb set completeopt?')
30 else
31 redir => completeopt
32 silent verb set completeopt?
33 redir END
34 endif
35 if len(split(completeopt, '\n')) == 1
36 set completeopt=menuone,longest
37 if v:version > 801 || (v:version == 801 && has('patch-8.1.1882'))
38 set completeopt+=popup
39 else
40 set completeopt+=preview
41 endif
42 endif
43 endfunction
44 if has('nvim')
45 call s:setup_completeopt()
46 else
47 augroup jedi_startup
48 au!
49 autocmd VimEnter * call s:setup_completeopt()
50 augroup END
51 endif
52
53 if len(mapcheck('<C-c>', 'i')) == 0
54 inoremap <C-c> <ESC>
55 endif
56 endif
57
58 " Pyimport command
59 command! -nargs=1 -complete=custom,jedi#py_import_completions Pyimport :call jedi#py_import(<q-args>)
60
61 command! -nargs=? -complete=file JediChooseEnvironment :call jedi#choose_environment(<q-args>)
62 command! -nargs=? -complete=file JediLoadProject :call jedi#load_project(<q-args>)
63
64
65 function! s:jedi_debug_info()
66 " Ensure the autoload file has been loaded (and ignore any errors, which
67 " will be displayed with the debug info).
68 let unset = {}
69 let saved_squelch_py_warning = get(g:, 'jedi#squelch_py_warning', unset)
70 let g:jedi#squelch_py_warning = 1
71 call jedi#init_python()
72 if saved_squelch_py_warning is unset
73 unlet g:jedi#squelch_py_warning
74 else
75 let g:jedi#squelch_py_warning = saved_squelch_py_warning
76 endif
77 call jedi#debug_info()
78 endfunction
79 command! -nargs=0 -bar JediDebugInfo call s:jedi_debug_info()
80 command! -nargs=0 -bang JediClearCache call jedi#clear_cache(<bang>0)
81
82 " vim: set et ts=4: