mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-18 15:21:16 +02:00
37 lines
856 B
Text
37 lines
856 B
Text
#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 "$@"
|