| 1 |
if !jedi#init_python() |
| 2 |
finish |
| 3 |
endif |
| 4 |
" ------------------------------------------------------------------------ |
| 5 |
" Initialization of jedi-vim |
| 6 |
" ------------------------------------------------------------------------ |
| 7 |
|
| 8 |
if g:jedi#auto_initialization |
| 9 |
" goto / get_definition / usages |
| 10 |
if len(g:jedi#goto_command) |
| 11 |
execute 'nnoremap <buffer> '.g:jedi#goto_command.' :call jedi#goto()<CR>' |
| 12 |
endif |
| 13 |
if len(g:jedi#goto_assignments_command) |
| 14 |
execute 'nnoremap <buffer> '.g:jedi#goto_assignments_command.' :call jedi#goto_assignments()<CR>' |
| 15 |
endif |
| 16 |
if len(g:jedi#goto_definitions_command) |
| 17 |
execute 'nnoremap <buffer> '.g:jedi#goto_definitions_command.' :call jedi#goto_definitions()<CR>' |
| 18 |
endif |
| 19 |
if len(g:jedi#goto_stubs_command) |
| 20 |
execute 'nnoremap <buffer> '.g:jedi#goto_stubs_command.' :call jedi#goto_stubs()<CR>' |
| 21 |
endif |
| 22 |
if len(g:jedi#usages_command) |
| 23 |
execute 'nnoremap <buffer> '.g:jedi#usages_command.' :call jedi#usages()<CR>' |
| 24 |
endif |
| 25 |
" rename |
| 26 |
if len(g:jedi#rename_command) |
| 27 |
execute 'nnoremap <buffer> '.g:jedi#rename_command.' :call jedi#rename()<CR>' |
| 28 |
execute 'vnoremap <buffer> '.g:jedi#rename_command.' :call jedi#rename_visual()<CR>' |
| 29 |
endif |
| 30 |
if len(g:jedi#rename_command_keep_name) |
| 31 |
execute 'nnoremap <buffer> '.g:jedi#rename_command_keep_name.' :call jedi#rename_keep_name()<CR>' |
| 32 |
execute 'vnoremap <buffer> '.g:jedi#rename_command_keep_name.' :call jedi#rename_visual_keep_name()<CR>' |
| 33 |
endif |
| 34 |
" documentation/pydoc |
| 35 |
if len(g:jedi#documentation_command) |
| 36 |
execute 'nnoremap <silent> <buffer>'.g:jedi#documentation_command.' :call jedi#show_documentation()<CR>' |
| 37 |
endif |
| 38 |
|
| 39 |
if g:jedi#show_call_signatures > 0 |
| 40 |
call jedi#configure_call_signatures() |
| 41 |
endif |
| 42 |
|
| 43 |
if g:jedi#completions_enabled == 1 |
| 44 |
inoremap <silent> <buffer> . .<C-R>=jedi#complete_string(1)<CR> |
| 45 |
endif |
| 46 |
|
| 47 |
if g:jedi#smart_auto_mappings == 1 |
| 48 |
inoremap <silent> <buffer> <space> <C-R>=jedi#smart_auto_mappings()<CR> |
| 49 |
end |
| 50 |
|
| 51 |
if g:jedi#auto_close_doc && (&g:completeopt =~# '\<preview\>' && &g:completeopt !~# '\<popup\>') |
| 52 |
" close preview if its still open after insert |
| 53 |
augroup jedi_preview |
| 54 |
if v:version > 704 |
| 55 |
autocmd CompleteDone <buffer> pclose |
| 56 |
else |
| 57 |
autocmd InsertLeave <buffer> if pumvisible() == 0|pclose|endif |
| 58 |
autocmd CursorMovedI <buffer> if pumvisible() == 0|pclose|endif |
| 59 |
endif |
| 60 |
augroup END |
| 61 |
endif |
| 62 |
endif |