From a9c654fe48550167e204381c305b19e6d0229ae0 Mon Sep 17 00:00:00 2001 From: David Halter Date: Sat, 24 Aug 2013 21:22:04 +0430 Subject: [PATCH] added a way to disable completions, as mentioned in #166 --- ftplugin/python/jedi.vim | 27 ++++++++++++++------------- plugin/jedi.vim | 7 +++++-- test/completions.vim | 2 +- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/ftplugin/python/jedi.vim b/ftplugin/python/jedi.vim index 2964eef..42d6ba9 100644 --- a/ftplugin/python/jedi.vim +++ b/ftplugin/python/jedi.vim @@ -8,20 +8,21 @@ endif " ------------------------------------------------------------------------ if g:jedi#auto_initialization - setlocal omnifunc=jedi#completions + if g:jedi#completions_enabled + setlocal omnifunc=jedi#completions - " map ctrl+space for autocompletion - - if g:jedi#completions_command == "" - " in terminals, sometimes equals - inoremap pumvisible() \|\| &omnifunc == '' ? - \ "\C-n>" : - \ "\C-x>\C-o>=pumvisible() ?" . - \ "\"\\c-n>\\c-p>\\c-n>\" :" . - \ "\" \\bs>\\C-n>\"\" - endif - if g:jedi#completions_command != "" - execute "inoremap ".g:jedi#completions_command." " + " map ctrl+space for autocompletion + if g:jedi#completions_command == "" + " in terminals, sometimes equals + inoremap pumvisible() \|\| &omnifunc == '' ? + \ "\C-n>" : + \ "\C-x>\C-o>=pumvisible() ?" . + \ "\"\\c-n>\\c-p>\\c-n>\" :" . + \ "\" \\bs>\\C-n>\"\" + endif + if g:jedi#completions_command != "" + execute "inoremap ".g:jedi#completions_command." " + endif endif " goto / get_definition / usages diff --git a/plugin/jedi.vim b/plugin/jedi.vim index d5a25b2..8704736 100644 --- a/plugin/jedi.vim +++ b/plugin/jedi.vim @@ -59,7 +59,8 @@ let s:settings = { \ 'call_signature_escape': "'≡'", \ 'auto_close_doc': 1, \ 'popup_select_first': 1, - \ 'quickfix_window_height': 10 + \ 'quickfix_window_height': 10, + \ 'completions_enabled': 1 \ } for [key, val] in items(s:settings) @@ -76,7 +77,9 @@ if g:jedi#auto_initialization " this is only here because in some cases the VIM library adds their " autocompletion as a default, which may cause problems, depending on the " order of invocation. - autocmd FileType Python setlocal omnifunc=jedi#completions switchbuf=useopen " needed for documentation/pydoc + if g:jedi#completions_enabled + autocmd FileType Python setlocal omnifunc=jedi#completions switchbuf=useopen " needed for documentation/pydoc + endif endif diff --git a/test/completions.vim b/test/completions.vim index 237b60a..4145c22 100644 --- a/test/completions.vim +++ b/test/completions.vim @@ -8,7 +8,7 @@ describe 'completions' end after - close! + bd! end it 'import'