diff --git a/autoload/jedi.vim b/autoload/jedi.vim index 982dac8..b2d0b4e 100644 --- a/autoload/jedi.vim +++ b/autoload/jedi.vim @@ -127,7 +127,7 @@ function! s:syn_stack() endfunc -function! jedi#do_popup_on_dot() +function! jedi#do_popup_on_dot_in_highlight() let highlight_groups = s:syn_stack() for a in highlight_groups if a == 'pythonDoctest' @@ -146,6 +146,23 @@ function! jedi#do_popup_on_dot() endfunc +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 "\\\" + else + return "\\" + end + else + return "\\\" + end + else + return '' + end +endfunction + + function! jedi#configure_call_signatures() autocmd InsertLeave Python jedi_vim.clear_call_signatures() autocmd CursorMovedI call jedi#show_call_signatures_func() @@ -172,7 +189,9 @@ endfunction function! jedi#auto_complete_string() if pumvisible() - return "\" + if g:jedi#popup_select_first + return "\" + end else return "\\\=jedi#auto_complete_opened()\" end diff --git a/ftplugin/python/jedi.vim b/ftplugin/python/jedi.vim index 148f842..72afa66 100644 --- a/ftplugin/python/jedi.vim +++ b/ftplugin/python/jedi.vim @@ -43,6 +43,13 @@ if g:jedi#auto_initialization if g:jedi#show_call_signatures == 1 && has('conceal') call jedi#configure_call_signatures() endif + + inoremap . .=jedi#popup_on_dot_string() + + if g:jedi#auto_close_doc + " close preview if its still open after insert + autocmd InsertLeave if pumvisible() == 0|pclose|endif + end end if g:jedi#auto_vim_configuration @@ -51,21 +58,3 @@ if g:jedi#auto_vim_configuration inoremap end end - -if g:jedi#popup_on_dot - if stridx(&completeopt, 'longest') > -1 - if g:jedi#popup_select_first - inoremap . .=jedi#do_popup_on_dot() ? "\C-X>\C-O>\Down>" : "" - else - inoremap . .=jedi#do_popup_on_dot() ? "\C-X>\C-O>" : "" - end - - else - inoremap . .=jedi#do_popup_on_dot() ? "\C-X>\C-O>\C-P>" : "" - end -end - -if g:jedi#auto_close_doc - " close preview if its still open after insert - autocmd InsertLeave if pumvisible() == 0|pclose|endif -end