Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to disable default keybindings. #943

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions doc/jedi-vim.txt
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,9 @@ example, to set the keybinding for starting omnicompletion to <C-N> instead of

let g:jedi#completions_command = "<C-N>"

Note: If you have |g:jedi#disable_default_mappings| set to 1, you can disable
all the default keybindings.

Note: If you have |g:jedi#auto_initialization| set to 0, you have to create
a mapping yourself by calling a function: >

Expand Down
52 changes: 29 additions & 23 deletions ftplugin/python/jedi.vim
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,35 @@ endif

if g:jedi#auto_initialization
" goto / get_definition / usages
if len(g:jedi#goto_command)
execute 'nnoremap <buffer> '.g:jedi#goto_command.' :call jedi#goto()<CR>'
endif
if len(g:jedi#goto_assignments_command)
execute 'nnoremap <buffer> '.g:jedi#goto_assignments_command.' :call jedi#goto_assignments()<CR>'
endif
if len(g:jedi#goto_definitions_command)
execute 'nnoremap <buffer> '.g:jedi#goto_definitions_command.' :call jedi#goto_definitions()<CR>'
endif
if len(g:jedi#goto_stubs_command)
execute 'nnoremap <buffer> '.g:jedi#goto_stubs_command.' :call jedi#goto_stubs()<CR>'
endif
if len(g:jedi#usages_command)
execute 'nnoremap <buffer> '.g:jedi#usages_command.' :call jedi#usages()<CR>'
endif
" rename
if len(g:jedi#rename_command)
execute 'nnoremap <buffer> '.g:jedi#rename_command.' :call jedi#rename()<CR>'
execute 'vnoremap <buffer> '.g:jedi#rename_command.' :call jedi#rename_visual()<CR>'
endif
" documentation/pydoc
if len(g:jedi#documentation_command)
execute 'nnoremap <silent> <buffer>'.g:jedi#documentation_command.' :call jedi#show_documentation()<CR>'
if !exists("g:jedi#disable_default_mappings")
let g:jedi#disable_default_mappings = 0
endif
if g:jedi#disable_default_mappings != 1
" skip the key bindings
if len(g:jedi#goto_command)
execute 'nnoremap <buffer> '.g:jedi#goto_command.' :call jedi#goto()<CR>'
endif
if len(g:jedi#goto_assignments_command)
execute 'nnoremap <buffer> '.g:jedi#goto_assignments_command.' :call jedi#goto_assignments()<CR>'
endif
if len(g:jedi#goto_definitions_command)
execute 'nnoremap <buffer> '.g:jedi#goto_definitions_command.' :call jedi#goto_definitions()<CR>'
endif
if len(g:jedi#goto_stubs_command)
execute 'nnoremap <buffer> '.g:jedi#goto_stubs_command.' :call jedi#goto_stubs()<CR>'
endif
if len(g:jedi#usages_command)
execute 'nnoremap <buffer> '.g:jedi#usages_command.' :call jedi#usages()<CR>'
endif
" rename
if len(g:jedi#rename_command)
execute 'nnoremap <buffer> '.g:jedi#rename_command.' :call jedi#rename()<CR>'
execute 'vnoremap <buffer> '.g:jedi#rename_command.' :call jedi#rename_visual()<CR>'
endif
" documentation/pydoc
if len(g:jedi#documentation_command)
execute 'nnoremap <silent> <buffer>'.g:jedi#documentation_command.' :call jedi#show_documentation()<CR>'
endif
endif

if g:jedi#show_call_signatures > 0 && has('conceal')
Expand Down