forked from python-mode/python-mode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdoc.vim
More file actions
34 lines (27 loc) · 954 Bytes
/
doc.vim
File metadata and controls
34 lines (27 loc) · 954 Bytes
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
" DESC: Set scriptname
let g:scriptname = expand("<sfile>:t")
" OPTION: g:pymode_doc -- bool. Show documentation enabled
call helpers#SafeVar("g:pymode_doc", 1)
" OPTION: g:pymode_doc_key -- string. Key for show python documantation.
call helpers#SafeVar("g:pymode_doc_key", "K")
" DESC: Disable script loading
if helpers#SafeVar("b:doc", 1) || g:pymode_doc == 0
finish
endif
" DESC: Check pydoc installed
if !helpers#CheckProgramm("pydoc")
finish
endif
" DESC: Show python documentation
" ARGS: word -- string, word for search
fun! <SID>:PydocLoad(word) "{{{
if a:word == ''
echoerr "no name/symbol under cursor!"
return 0
endif
call helpers#ShowPreviewCmd(g:pydoc . " " . escape(a:word, " "))
endfunction "}}}
" DESC: Set commands
command! -buffer -nargs=+ Pydoc call <SID>:PydocLoad("<args>")
" DESC: Set keys
exe "nnoremap <silent> <buffer> " g:pymode_doc_key ":call <SID>:PydocLoad(expand('<cword>'))<CR>"