From f234bf43760185ded87c137c18766b09573c3dc9 Mon Sep 17 00:00:00 2001 From: Jean-Louis Fuchs Date: Mon, 21 Jan 2013 18:08:19 +0100 Subject: [PATCH] Select first line of completion popup. Improves typing flow and saves one keypress. --- README.rst | 7 +++++++ ftplugin/python/jedi.vim | 7 ++++++- plugin/jedi.vim | 3 ++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 2fccac6..8d16e4c 100644 --- a/README.rst +++ b/README.rst @@ -106,6 +106,13 @@ you don't want this: let g:jedi#popup_on_dot = 0 +Jedi selects the first line of the completion menu: for a better typing-flow and +usually saves one keypress. + +.. code-block:: vim + + let g:jedi#popup_select_first = 0 + There's some support for refactoring: .. code-block:: vim diff --git a/ftplugin/python/jedi.vim b/ftplugin/python/jedi.vim index 3b9319b..3bf131c 100644 --- a/ftplugin/python/jedi.vim +++ b/ftplugin/python/jedi.vim @@ -40,7 +40,12 @@ end if g:jedi#popup_on_dot if stridx(&completeopt, 'longest') > -1 - inoremap . .=jedi#do_popup_on_dot() ? "\C-X>\C-O>" : "" + if g:jedi#popup_select_first + inoremap . .=jedi#do_popup_on_dot() ? "\C-X>\C-O>\C-N>" : "" + 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 diff --git a/plugin/jedi.vim b/plugin/jedi.vim index 6528bfd..e7ee905 100644 --- a/plugin/jedi.vim +++ b/plugin/jedi.vim @@ -34,7 +34,8 @@ let s:settings = { \ 'pydoc': "'K'", \ 'show_function_definition': 1, \ 'function_definition_escape': "'≡'", - \ 'auto_close_doc': 1 + \ 'auto_close_doc': 1, + \ 'popup_select_first': 1 \ } for [key, val] in items(s:settings)