about summary refs log tree commit diff
path: root/Completion/Base/Completer
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2001-04-02 11:08:19 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2001-04-02 11:08:19 +0000
commit382d03c17d6a43a278f3802a44fa15bcd7fd6de7 (patch)
treefa5a1d5ffedc6c68f4deab841a541ae118f20db4 /Completion/Base/Completer
parentf347145efc6cce72c24bd9aade83bd970918c569 (diff)
downloadzsh-382d03c17d6a43a278f3802a44fa15bcd7fd6de7.tar.gz
zsh-382d03c17d6a43a278f3802a44fa15bcd7fd6de7.tar.xz
zsh-382d03c17d6a43a278f3802a44fa15bcd7fd6de7.zip
moved from Completion/Core/_menu
Diffstat (limited to 'Completion/Base/Completer')
-rw-r--r--Completion/Base/Completer/_menu23
1 files changed, 23 insertions, 0 deletions
diff --git a/Completion/Base/Completer/_menu b/Completion/Base/Completer/_menu
new file mode 100644
index 000000000..41fc178ba
--- /dev/null
+++ b/Completion/Base/Completer/_menu
@@ -0,0 +1,23 @@
+#autoload
+
+[[ _matcher_num -gt 1 ]] && return 1
+
+# This completer is an example showing how menucompletion can be
+# implemented with the new completion system.
+# Use this one before the normal _complete completer, as in:
+#
+#   zstyle ":completion:::::" completer _menu _complete
+
+if [[ -n "$compstate[old_list]" ]]; then
+
+  # We have an old list, keep it and insert the next match.
+
+  compstate[old_list]=keep
+  compstate[insert]=$((compstate[old_insert]+1))
+else
+  # No old list, make completion insert the first match.
+
+  compstate[insert]=1
+fi
+
+return 1