added a way to disable completions, as mentioned in #166

This commit is contained in:
David Halter
2013-08-24 21:22:04 +04:30
parent 6c9b115661
commit a9c654fe48
3 changed files with 20 additions and 16 deletions

View File

@@ -8,20 +8,21 @@ endif
" ------------------------------------------------------------------------ " ------------------------------------------------------------------------
if g:jedi#auto_initialization if g:jedi#auto_initialization
setlocal omnifunc=jedi#completions if g:jedi#completions_enabled
setlocal omnifunc=jedi#completions
" map ctrl+space for autocompletion " map ctrl+space for autocompletion
if g:jedi#completions_command == "<C-Space>"
if g:jedi#completions_command == "<C-Space>" " in terminals, <C-Space> sometimes equals <Nul>
" in terminals, <C-Space> sometimes equals <Nul> inoremap <expr> <Nul> pumvisible() \|\| &omnifunc == '' ?
inoremap <expr> <Nul> pumvisible() \|\| &omnifunc == '' ? \ "\<lt>C-n>" :
\ "\<lt>C-n>" : \ "\<lt>C-x>\<lt>C-o><c-r>=pumvisible() ?" .
\ "\<lt>C-x>\<lt>C-o><c-r>=pumvisible() ?" . \ "\"\\<lt>c-n>\\<lt>c-p>\\<lt>c-n>\" :" .
\ "\"\\<lt>c-n>\\<lt>c-p>\\<lt>c-n>\" :" . \ "\" \\<lt>bs>\\<lt>C-n>\"\<CR>"
\ "\" \\<lt>bs>\\<lt>C-n>\"\<CR>" endif
endif if g:jedi#completions_command != ""
if g:jedi#completions_command != "" execute "inoremap <buffer>".g:jedi#completions_command." <C-X><C-O>"
execute "inoremap <buffer>".g:jedi#completions_command." <C-X><C-O>" endif
endif endif
" goto / get_definition / usages " goto / get_definition / usages

View File

@@ -59,7 +59,8 @@ let s:settings = {
\ 'call_signature_escape': "'≡'", \ 'call_signature_escape': "'≡'",
\ 'auto_close_doc': 1, \ 'auto_close_doc': 1,
\ 'popup_select_first': 1, \ 'popup_select_first': 1,
\ 'quickfix_window_height': 10 \ 'quickfix_window_height': 10,
\ 'completions_enabled': 1
\ } \ }
for [key, val] in items(s:settings) 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 " this is only here because in some cases the VIM library adds their
" autocompletion as a default, which may cause problems, depending on the " autocompletion as a default, which may cause problems, depending on the
" order of invocation. " 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 endif

View File

@@ -8,7 +8,7 @@ describe 'completions'
end end
after after
close! bd!
end end
it 'import' it 'import'