about summary refs log tree commit diff
path: root/Completion/Commands
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>2000-03-23 23:59:08 +0000
committerTanaka Akira <akr@users.sourceforge.net>2000-03-23 23:59:08 +0000
commit993db7cf0267b4d9c7f8faaa40af8948ba26a2e2 (patch)
treea7124bd5d1ce193f582e10873b229cc0b3214507 /Completion/Commands
parent2b38f6f4e5b78c26ae617dfe6974a2de98d1e455 (diff)
downloadzsh-993db7cf0267b4d9c7f8faaa40af8948ba26a2e2.tar.gz
zsh-993db7cf0267b4d9c7f8faaa40af8948ba26a2e2.tar.xz
zsh-993db7cf0267b4d9c7f8faaa40af8948ba26a2e2.zip
zsh-workers/10210
Diffstat (limited to 'Completion/Commands')
-rw-r--r--Completion/Commands/_next_tags62
1 files changed, 29 insertions, 33 deletions
diff --git a/Completion/Commands/_next_tags b/Completion/Commands/_next_tags
index 818b73fe0..028ba4d61 100644
--- a/Completion/Commands/_next_tags
+++ b/Completion/Commands/_next_tags
@@ -1,49 +1,45 @@
-#autoload
+#compdef -k complete-word \C-xn
 
-# To use this, put _next_tags at the beginning of the completer style,
-# define it as a completion widget and bind it to a key, e.g.:
-#
-#  zle -C _next_tags complete-word _next_tags
-#  bindkey '^Xn' _next_tags
-#
-# Makes it be bound to ^Xn.
-
-
-# Main widget/completer.
+# Main widget.
 
 _next_tags() {
+  local comp
 
-  if [[ $#funcstack -gt 1 ]]; then
+  if [[ -z $compstate[old_list] ]]; then
+    comp=()
+  else
+    comp=(_complete)
+  fi
 
-    # Called as completer, probably `remove' our helper function. A better
-    # test would be nice, but I think one should still be able to edit the
-    # current word between attempts to complete it.
+  (( $+_sort_tags )) || _next_tags_not=
 
-    [[ $_next_tags_pre != ${LBUFFER%${PREFIX}} ]] && unset _sort_tags
+  _sort_tags=_next_tags_sort
+  _next_tags_pre="${LBUFFER%${PREFIX}}"
+  _next_tags_not="$_next_tags_not $_lastcomp[tags]"
 
-    return 1
-  else
-    local comp
+  _main_complete "$comp[@]"
 
-    if [[ -z $compstate[old_list] ]]; then
-      comp=()
-    else
-      comp=(_next_tags _complete)
-    fi
+  [[ $compstate[insert] = automenu ]] &&
+     compstate[insert]=automenu-unambiguous
 
-    (( $+_sort_tags )) || _next_tags_not=
+  compstate[insert]=''
+  compstate[list]='list force'
 
-    _sort_tags=_next_tags_sort
-    _next_tags_pre="${LBUFFER%${PREFIX}}"
-    _next_tags_not="$_next_tags_not $_lastcomp[tags]"
+  compprefuncs=( "$compprefuncs[@]" _next_tags_pre )
+}
 
-    _main_complete "$comp[@]"
+# Pre-completion function.
 
-    [[ $compstate[insert] = automenu ]] &&
-       compstate[insert]=automenu-unambiguous
+_next_tags_pre() {
 
-    compstate[insert]=''
-    compstate[list]='list force'
+  # Probably `remove' our sort function. A better test would be nice, but
+  # I think one should still be able to edit the current word between
+  # attempts to complete it.
+
+  if [[ $_next_tags_pre != ${LBUFFER%${PREFIX}} ]]; then
+    unset _sort_tags
+  else
+    compprefuncs=( "$compprefuncs[@]" _next_tags_pre )
   fi
 }