Add gpgwkd function for gpg key fetches
[zsh.git] / .zsh / external / zaw / sources / perldoc.zsh
1 function zaw-src-perldoc() {
2 local code_wanted
3 local -a words
4
5 # XXX: override _wanted to capture module list _perl_modules generates
6 code_wanted="${functions[_wanted]}"
7 function _wanted() {
8 candidates=("${(P@)${@[7]}}")
9 }
10
11 # required by _perl_modules
12 words=(perldoc)
13
14 _perl_modules
15
16 # restore original function
17 eval "function _wanted() { $code_wanted }"
18
19 actions=("zaw-callback-perldoc-view" "zaw-callback-perldoc-vim")
20 act_descriptions=("view perldoc" "open with vim")
21 }
22
23 zaw-register-src -n perldoc zaw-src-perldoc
24
25 function zaw-callback-perldoc-view() {
26 local orig_buffer="${BUFFER}"
27 BUFFER=" perldoc '$1'"
28 zle accept-line
29 }
30
31 function zaw-callback-perldoc-vim() {
32 local orig_buffer="${BUFFER}"
33 BUFFER=" vim -R $(perldoc -lm "$1")"
34 zle accept-line
35 }