about summary refs log tree commit diff
path: root/Completion/Zsh/Context/_tilde
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2001-04-02 11:24:49 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2001-04-02 11:24:49 +0000
commit134b17eb0f05e10de957c6a5053515e929eb31fb (patch)
tree46670f44370c144fb2808c16a6d338a3cdf298a5 /Completion/Zsh/Context/_tilde
parent2cb2aa16d0ba87bafe97016890a420b7b02d8be4 (diff)
downloadzsh-134b17eb0f05e10de957c6a5053515e929eb31fb.tar.gz
zsh-134b17eb0f05e10de957c6a5053515e929eb31fb.tar.xz
zsh-134b17eb0f05e10de957c6a5053515e929eb31fb.zip
moved from Completion/Base/_tilde
Diffstat (limited to 'Completion/Zsh/Context/_tilde')
-rw-r--r--Completion/Zsh/Context/_tilde30
1 files changed, 30 insertions, 0 deletions
diff --git a/Completion/Zsh/Context/_tilde b/Completion/Zsh/Context/_tilde
new file mode 100644
index 000000000..7d7bf5aea
--- /dev/null
+++ b/Completion/Zsh/Context/_tilde
@@ -0,0 +1,30 @@
+#compdef -tilde-
+
+# We use all named directories and user names here. If this is too slow
+# for you or if there are too many of them, you may want to use
+# `compadd -qS/ -a friends' or something like that.
+
+[[ -n "$compstate[quote]" ]] && return 1
+
+local expl suf dirs list lines revlines i ret disp nm="$compstate[nmatches]"
+
+if [[ "$SUFFIX" = */* ]]; then
+  ISUFFIX="/${SUFFIX#*/}$ISUFFIX"
+  SUFFIX="${SUFFIX%%/*}"
+  suf=(-S '')
+else
+  suf=(-qS/)
+fi
+
+_tags users named-directories directory-stack
+
+while _tags; do
+  _requested users && _users "$suf[@]" "$@" && ret=0
+
+  _requested named-directories expl 'named directory' \
+      compadd "$suf[@]" "$@" -k nameddirs
+
+  _requested directory-stack && _directory_stack "$suf[@]" && ret=0
+
+  (( ret )) || return 0
+done