mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-24 05:11:08 +02:00
Initial revision
This commit is contained in:
parent
22fe82a7bb
commit
882a6d2e2c
2 changed files with 56 additions and 0 deletions
35
Completion/Commands/_complete_help
Normal file
35
Completion/Commands/_complete_help
Normal file
|
@ -0,0 +1,35 @@
|
|||
#compdef -k complete-word \C-xh
|
||||
|
||||
_complete_help() {
|
||||
local _sort_tags=_help_sort_tags text i
|
||||
typeset -A help_tags
|
||||
typeset -U help_contexts
|
||||
|
||||
help_contexts=()
|
||||
|
||||
compadd() { return 1 }
|
||||
|
||||
_main_complete
|
||||
|
||||
unfunction compadd
|
||||
|
||||
for i in "$help_contexts[@]"; do
|
||||
text="${text}
|
||||
tags in context \`${i}': ${help_tags[$i]}"
|
||||
done
|
||||
|
||||
compstate[list]=list
|
||||
compstate[force_list]=yes
|
||||
compstate[insert]=''
|
||||
|
||||
compadd -UX "$text[2,-1]" -n ''
|
||||
}
|
||||
|
||||
_help_sort_tags() {
|
||||
help_contexts=( "$help_contexts[@]" "$curcontext" )
|
||||
help_tags[$curcontext]="${help_tags[$curcontext]}
|
||||
${argv}"
|
||||
comptry "$@"
|
||||
}
|
||||
|
||||
_complete_help "$@"
|
21
Completion/Core/_wanted
Normal file
21
Completion/Core/_wanted
Normal file
|
@ -0,0 +1,21 @@
|
|||
#autoload
|
||||
|
||||
local targs
|
||||
|
||||
if [[ "$1" = -C?* ]]; then
|
||||
targs=( -C "${1[3,-1]}" )
|
||||
shift
|
||||
elif [[ "$1" = -C ]]; then
|
||||
targs=( -C "$2" )
|
||||
shift 2
|
||||
else
|
||||
targs=()
|
||||
fi
|
||||
|
||||
[[ "$1" = -(|-) ]] && shift
|
||||
|
||||
if [[ $# -gt 1 ]]; then
|
||||
_tags "$targs[@]" "$1" && _description "${(@)argv[2,-1]}"
|
||||
else
|
||||
_tags "$targs[@]" "$1"
|
||||
fi
|
Loading…
Reference in a new issue