blob: 9d3e47adde29106cf81d60eade6a98b042550a5c (
plain) (
blame)
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
|
#compdef -k complete-word \C-xh
_complete_help() {
local _sort_tags=_help_sort_tags text i j
typeset -A help_funcs help_tags
compadd() { return 1 }
_main_complete
unfunction compadd
for i in "${(@k)help_funcs}"; do
text="${text}
tags in context :completion:${i}"
for j in "${(@s.:.)help_funcs[$i][2,-1]}"; do
text="${text}${help_tags[${i}${j}]} (${j})"
done
done
compstate[list]='list force'
compstate[insert]=''
compadd -UX "$text[2,-1]" -n ''
}
_help_sort_tags() {
local f="${${${funcstack[3,(i)_(main_complete|complete|approximate|normal)]}% *}#_(wanted|requested) }"
if [[ "$help_funcs[$curcontext]" != *${f}* ]]; then
help_funcs[$curcontext]="${help_funcs[$curcontext]}:${f}"
help_tags[${curcontext}${f}]="${help_tags[$curcontext]}
${argv}"
comptry "$@"
fi
}
_complete_help "$@"
|