mirror of
https://github.com/davidhalter/jedi-vim.git
synced 2025-12-07 03:04:30 +08:00
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).
This commit is contained in:
@@ -197,7 +197,6 @@ endfunction
|
|||||||
" ------------------------------------------------------------------------
|
" ------------------------------------------------------------------------
|
||||||
" deprecations
|
" deprecations
|
||||||
" ------------------------------------------------------------------------
|
" ------------------------------------------------------------------------
|
||||||
|
|
||||||
let s:deprecations = {
|
let s:deprecations = {
|
||||||
\ 'get_definition_command': 'goto_definitions_command',
|
\ 'get_definition_command': 'goto_definitions_command',
|
||||||
\ 'goto_command': 'goto_assignments_command',
|
\ 'goto_command': 'goto_assignments_command',
|
||||||
@@ -207,18 +206,9 @@ let s:deprecations = {
|
|||||||
\ 'show_function_definition': 'show_call_signatures',
|
\ '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
|
" defaults for jedi-vim
|
||||||
" ------------------------------------------------------------------------
|
" ------------------------------------------------------------------------
|
||||||
|
|
||||||
let s:settings = {
|
let s:settings = {
|
||||||
\ 'use_tabs_not_buffers': 1,
|
\ 'use_tabs_not_buffers': 1,
|
||||||
\ 'use_splits_not_buffers': 1,
|
\ 'use_splits_not_buffers': 1,
|
||||||
@@ -240,12 +230,21 @@ let s:settings = {
|
|||||||
\ 'completions_enabled': 1
|
\ 'completions_enabled': 1
|
||||||
\ }
|
\ }
|
||||||
|
|
||||||
for [key, val] in items(s:settings)
|
function! s:init()
|
||||||
if !exists('g:jedi#'.key)
|
for [key, val] in items(s:deprecations)
|
||||||
exe 'let g:jedi#'.key.' = '.val
|
if exists('g:jedi#'.key)
|
||||||
endif
|
echom "'g:jedi#".key."' is deprecated. Please use 'g:jedi#".val."' instead. Sorry for the inconvenience."
|
||||||
endfor
|
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
|
" Python initialization
|
||||||
|
|||||||
@@ -8,17 +8,17 @@ endif
|
|||||||
if g:jedi#auto_initialization
|
if g:jedi#auto_initialization
|
||||||
" goto / get_definition / usages
|
" goto / get_definition / usages
|
||||||
if g:jedi#goto_assignments_command != ''
|
if g:jedi#goto_assignments_command != ''
|
||||||
execute "noremap <buffer>".g:jedi#goto_assignments_command." :call jedi#goto_assignments()<CR>"
|
execute "nnoremap <buffer> ".g:jedi#goto_assignments_command." :call jedi#goto_assignments()<CR>"
|
||||||
endif
|
endif
|
||||||
if g:jedi#goto_definitions_command != ''
|
if g:jedi#goto_definitions_command != ''
|
||||||
execute "noremap <buffer>".g:jedi#goto_definitions_command." :call jedi#goto_definitions()<CR>"
|
execute "nnoremap <buffer> ".g:jedi#goto_definitions_command." :call jedi#goto_definitions()<CR>"
|
||||||
endif
|
endif
|
||||||
if g:jedi#usages_command != ''
|
if g:jedi#usages_command != ''
|
||||||
execute "noremap <buffer>".g:jedi#usages_command." :call jedi#usages()<CR>"
|
execute "nnoremap <buffer> ".g:jedi#usages_command." :call jedi#usages()<CR>"
|
||||||
endif
|
endif
|
||||||
" rename
|
" rename
|
||||||
if g:jedi#rename_command != ''
|
if g:jedi#rename_command != ''
|
||||||
execute "noremap <buffer>".g:jedi#rename_command." :call jedi#rename()<CR>"
|
execute "nnoremap <buffer> ".g:jedi#rename_command." :call jedi#rename()<CR>"
|
||||||
endif
|
endif
|
||||||
" documentation/pydoc
|
" documentation/pydoc
|
||||||
if g:jedi#documentation_command != ''
|
if g:jedi#documentation_command != ''
|
||||||
|
|||||||
Reference in New Issue
Block a user