#autoload local expl pattern local -a fake autoload -U add-zle-hook-widget add-zle-hook-widget -h >&/dev/null # sets the zstyle zstyle -g fake zle-hook types fake=( zle-${^fake} ) pattern=( -g \* ) zparseopts -D -K -E g:=pattern _description widgets expl widget compadd "$@" "$expl[@]" -M 'r:|-=* r:|=*' - "${(@k)widgets[(R)${pattern[2]}]}" "${(@M)fake:#${~pattern[2]}}"