change some more complete_string details

This commit is contained in:
David Halter
2013-08-28 19:36:57 +04:30
parent 3934359666
commit dd426c6369
2 changed files with 15 additions and 24 deletions

View File

@@ -147,19 +147,6 @@ endfunc
function! jedi#popup_on_dot_string() function! jedi#popup_on_dot_string()
if g:jedi#popup_on_dot && jedi#do_popup_on_dot_in_highlight()
if stridx(&completeopt, 'longest') > -1
if g:jedi#popup_select_first
return "\<C-X>\<C-O>\<Down>"
else
return "\<C-X>\<C-O>"
end
else
return "\<C-X>\<C-O>\<C-P>"
end
else
return ''
end
endfunction endfunction
@@ -187,18 +174,22 @@ function! jedi#_vim_exceptions(str, is_eval)
endfunction endfunction
function! jedi#auto_complete_string() function! jedi#complete_string(is_popup_on_dot)
if pumvisible()
if g:jedi#popup_select_first if a:is_popup_on_dot && !(g:jedi#popup_on_dot && jedi#do_popup_on_dot_in_highlight())
return "\<C-n>" return ''
end end
if pumvisible() && !a:is_popup_on_dot
return "\<C-n>"
else else
return "\<C-x>\<C-o>\<C-r>=jedi#auto_complete_opened()\<CR>" return "\<C-x>\<C-o>\<C-r>=jedi#complete_opened()\<CR>"
end end
endfunction endfunction
function! jedi#auto_complete_opened() function! jedi#complete_opened()
if pumvisible() if pumvisible() && g:jedi#popup_select_first && stridx(&completeopt, 'longest') > -1
" only go down if it is visible, user-enabled and the longest option is set
return "\<Down>" return "\<Down>"
end end
return "" return ""

View File

@@ -14,10 +14,10 @@ if g:jedi#auto_initialization
" 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> jedi#auto_complete_string() inoremap <expr> <Nul> jedi#complete_string(0)
endif endif
if g:jedi#completions_command != "" if g:jedi#completions_command != ""
execute "inoremap <expr> <buffer> ".g:jedi#completions_command." jedi#auto_complete_string()" execute "inoremap <expr> <buffer> ".g:jedi#completions_command." jedi#complete_string(0)"
endif endif
endif endif
@@ -44,7 +44,7 @@ if g:jedi#auto_initialization
call jedi#configure_call_signatures() call jedi#configure_call_signatures()
endif endif
inoremap <silent> <buffer> . .<C-R>=jedi#popup_on_dot_string()<CR> inoremap <silent> <buffer> . .<C-R>=jedi#complete_string(1)<CR>
if g:jedi#auto_close_doc if g:jedi#auto_close_doc
" close preview if its still open after insert " close preview if its still open after insert