File: jedi.vim

package info (click to toggle)
python-jedi 0.19.1%2Bds1-1
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 11,680 kB
  • sloc: python: 28,783; makefile: 172; ansic: 13
file content (62 lines) | stat: -rw-r--r-- 2,548 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
if !jedi#init_python()
    finish
endif
" ------------------------------------------------------------------------
" Initialization of jedi-vim
" ------------------------------------------------------------------------

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
    if len(g:jedi#rename_command_keep_name)
        execute 'nnoremap <buffer> '.g:jedi#rename_command_keep_name.' :call jedi#rename_keep_name()<CR>'
        execute 'vnoremap <buffer> '.g:jedi#rename_command_keep_name.' :call jedi#rename_visual_keep_name()<CR>'
    endif
    " documentation/pydoc
    if len(g:jedi#documentation_command)
        execute 'nnoremap <silent> <buffer>'.g:jedi#documentation_command.' :call jedi#show_documentation()<CR>'
    endif

    if g:jedi#show_call_signatures > 0
        call jedi#configure_call_signatures()
    endif

    if g:jedi#completions_enabled == 1
        inoremap <silent> <buffer> . .<C-R>=jedi#complete_string(1)<CR>
    endif

    if g:jedi#smart_auto_mappings == 1
        inoremap <silent> <buffer> <space> <C-R>=jedi#smart_auto_mappings()<CR>
    end

    if g:jedi#auto_close_doc && (&g:completeopt =~# '\<preview\>' && &g:completeopt !~# '\<popup\>')
        " close preview if its still open after insert
        augroup jedi_preview
            if v:version > 704
                autocmd CompleteDone <buffer> pclose
            else
                autocmd InsertLeave <buffer> if pumvisible() == 0|pclose|endif
                autocmd CursorMovedI <buffer> if pumvisible() == 0|pclose|endif
            endif
        augroup END
    endif
endif