From 17bfd3b2765d7a092b089e0bd5c19cb6cbb2ef55 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Fri, 6 Dec 2013 15:00:38 -0500 Subject: [PATCH] fix #223: nnoremap instead of noremap - mapping operator-pending-mode and selection-mode has undesirable side-effects, and isn't actually used by jedi-vim. - also, wrap 'for' loops in s:init() functions to avoid polluting the global namespace ('for key in keys' assigns g:key). --- autoload/jedi.vim | 29 ++++++++++++++--------------- ftplugin/python/jedi.vim | 8 ++++---- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/autoload/jedi.vim b/autoload/jedi.vim index 201a8e3..1d6cb9f 100644 --- a/autoload/jedi.vim +++ b/autoload/jedi.vim @@ -197,7 +197,6 @@ endfunction " ------------------------------------------------------------------------ " deprecations " ------------------------------------------------------------------------ - let s:deprecations = { \ 'get_definition_command': 'goto_definitions_command', \ 'goto_command': 'goto_assignments_command', @@ -207,18 +206,9 @@ let s:deprecations = { \ 'show_function_definition': 'show_call_signatures', \ } -for [key, val] in items(s:deprecations) - if exists('g:jedi#'.key) - echom "'g:jedi#".key."' is deprecated. Please use 'g:jedi#".val."' instead. Sorry for the inconvenience." - exe 'let g:jedi#'.val.' = g:jedi#'.key - end -endfor - - " ------------------------------------------------------------------------ " defaults for jedi-vim " ------------------------------------------------------------------------ - let s:settings = { \ 'use_tabs_not_buffers': 1, \ 'use_splits_not_buffers': 1, @@ -240,12 +230,21 @@ let s:settings = { \ 'completions_enabled': 1 \ } -for [key, val] in items(s:settings) - if !exists('g:jedi#'.key) - exe 'let g:jedi#'.key.' = '.val - endif -endfor +function! s:init() + for [key, val] in items(s:deprecations) + if exists('g:jedi#'.key) + echom "'g:jedi#".key."' is deprecated. Please use 'g:jedi#".val."' instead. Sorry for the inconvenience." + exe 'let g:jedi#'.val.' = g:jedi#'.key + end + endfor + for [key, val] in items(s:settings) + if !exists('g:jedi#'.key) + exe 'let g:jedi#'.key.' = '.val + endif + endfor +endfunction +call s:init() " ------------------------------------------------------------------------ " Python initialization diff --git a/ftplugin/python/jedi.vim b/ftplugin/python/jedi.vim index 1260487..938b10c 100644 --- a/ftplugin/python/jedi.vim +++ b/ftplugin/python/jedi.vim @@ -8,17 +8,17 @@ endif if g:jedi#auto_initialization " goto / get_definition / usages if g:jedi#goto_assignments_command != '' - execute "noremap ".g:jedi#goto_assignments_command." :call jedi#goto_assignments()" + execute "nnoremap ".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()" + execute "nnoremap ".g:jedi#goto_definitions_command." :call jedi#goto_definitions()" endif if g:jedi#usages_command != '' - execute "noremap ".g:jedi#usages_command." :call jedi#usages()" + execute "nnoremap ".g:jedi#usages_command." :call jedi#usages()" endif " rename if g:jedi#rename_command != '' - execute "noremap ".g:jedi#rename_command." :call jedi#rename()" + execute "nnoremap ".g:jedi#rename_command." :call jedi#rename()" endif " documentation/pydoc if g:jedi#documentation_command != ''