diff --git a/README.rst b/README.rst index 4c95295..1525ae1 100644 --- a/README.rst +++ b/README.rst @@ -120,7 +120,7 @@ and usually saves one keypress. let g:jedi#popup_select_first = 0 Here are a few more defaults for actions, read the docs (``:help jedi-vim``) to -get more information. You can change them +get more information. If you set them to ``""``, they are not assigned. .. code-block:: vim @@ -133,7 +133,6 @@ get more information. You can change them let g:jedi#show_call_signatures = "1" - Testing ======= diff --git a/doc/jedi-vim.txt b/doc/jedi-vim.txt index 8733244..5b33187 100644 --- a/doc/jedi-vim.txt +++ b/doc/jedi-vim.txt @@ -192,6 +192,9 @@ a mapping yourself by calling a function: > nnoremap r :call jedi#rename() " etc. +Note: You can set commands to '', which means that they are empty and not +assigned. It's an easy way to "disable" functionality of jedi-vim. + ------------------------------------------------------------------------------ 5.1. `g:jedi#completions_command` *g:jedi#completions_command* Function: n/a; see above diff --git a/ftplugin/python/jedi.vim b/ftplugin/python/jedi.vim index a6189f0..2964eef 100644 --- a/ftplugin/python/jedi.vim +++ b/ftplugin/python/jedi.vim @@ -11,6 +11,7 @@ if g:jedi#auto_initialization setlocal omnifunc=jedi#completions " map ctrl+space for autocompletion + if g:jedi#completions_command == "" " in terminals, sometimes equals inoremap pumvisible() \|\| &omnifunc == '' ? @@ -19,16 +20,28 @@ if g:jedi#auto_initialization \ "\"\\c-n>\\c-p>\\c-n>\" :" . \ "\" \\bs>\\C-n>\"\" endif - execute "inoremap ".g:jedi#completions_command." " + if g:jedi#completions_command != "" + execute "inoremap ".g:jedi#completions_command." " + endif " goto / get_definition / usages - execute "noremap ".g:jedi#goto_assignments_command." :call jedi#goto_assignments()" - execute "noremap ".g:jedi#goto_definitions_command." :call jedi#goto_definitions()" - execute "noremap ".g:jedi#usages_command." :call jedi#usages()" + if g:jedi#goto_assignments_command != '' + execute "noremap ".g:jedi#goto_assignments_command." :call jedi#goto_assignments()" + endif + if g:jedi#goto_definitions_command != '' + execute "noremap ".g:jedi#goto_definitions_command." :call jedi#goto_definitions()" + endif + if g:jedi#usages_command != '' + execute "noremap ".g:jedi#usages_command." :call jedi#usages()" + endif " rename - execute "noremap ".g:jedi#rename_command." :call jedi#rename()" + if g:jedi#rename_command != '' + execute "noremap ".g:jedi#rename_command." :call jedi#rename()" + endif " documentation/pydoc - execute "nnoremap ".g:jedi#documentation_command." :call jedi#show_documentation()" + if g:jedi#documentation_command != '' + execute "nnoremap ".g:jedi#documentation_command." :call jedi#show_documentation()" + endif if g:jedi#show_call_signatures == 1 && has('conceal') call jedi#configure_call_signatures()