about summary refs log tree commit diff
path: root/Completion/Commands/_complete_help
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-11-15 12:01:46 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-11-15 12:01:46 +0000
commit35b2633ad941966f5fca07b625a594a5b68c0fdb (patch)
treeb54740d014e594ba5d81931cdcdb3387bcf9dfca /Completion/Commands/_complete_help
parentbb98460a01ce1f6c1e71f7e401f782c81b71486b (diff)
downloadzsh-35b2633ad941966f5fca07b625a594a5b68c0fdb.tar.gz
zsh-35b2633ad941966f5fca07b625a594a5b68c0fdb.tar.xz
zsh-35b2633ad941966f5fca07b625a594a5b68c0fdb.zip
manual/8639
Diffstat (limited to 'Completion/Commands/_complete_help')
-rw-r--r--Completion/Commands/_complete_help35
1 files changed, 35 insertions, 0 deletions
diff --git a/Completion/Commands/_complete_help b/Completion/Commands/_complete_help
new file mode 100644
index 000000000..cfefdcf90
--- /dev/null
+++ b/Completion/Commands/_complete_help
@@ -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 "$@"