aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>2000-02-04 16:11:15 +0000
committerTanaka Akira <akr@users.sourceforge.net>2000-02-04 16:11:15 +0000
commit625e843525cfd9d763eddcdb01663d4946f3a910 (patch)
tree8580fada9bf0c4e41e216c96dbc440c46f7e77ee
parent7823cf3bd2e03949f14eac8b61970f18fdadbecb (diff)
downloadzsh-625e843525cfd9d763eddcdb01663d4946f3a910.tar.gz
zsh-625e843525cfd9d763eddcdb01663d4946f3a910.tar.xz
zsh-625e843525cfd9d763eddcdb01663d4946f3a910.zip
Initial revision
-rw-r--r--Completion/Core/_prefix23
1 files changed, 23 insertions, 0 deletions
diff --git a/Completion/Core/_prefix b/Completion/Core/_prefix
new file mode 100644
index 000000000..6306b4aa0
--- /dev/null
+++ b/Completion/Core/_prefix
@@ -0,0 +1,23 @@
+#autoload
+
+# Try to ignore the suffix. A bit like e-o-c-prefix.
+
+[[ -n "$SUFFIX" ]] || return 1
+
+local curcontext="${curcontext/:[^:]#:/:prefix:}" comp i
+
+zstyle -a ":completion:${curcontext}:" completer comp ||
+ comp=( "${(@)_completers[1,-${#_completers_left}-1][(R)_prefix,-1]}" )
+
+if zstyle -t ":completion:${curcontext}:" add-space; then
+ ISUFFIX=" $SUFFIX"
+else
+ ISUFFIX="$SUFFIX"
+fi
+SUFFIX=''
+
+for i in "$comp[@]"; do
+ [[ "$i" != _prefix ]] && "$i" && return 0
+done
+
+return 1