aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>2000-02-25 09:53:20 +0000
committerTanaka Akira <akr@users.sourceforge.net>2000-02-25 09:53:20 +0000
commita0402f795ddb5025036612fa5f70efa8e976e42c (patch)
tree21d6379fba41b46ae8a22b317f6a0743eef01c9d
parent02801e27d5754ebc12bc02e43e244294df1e10a6 (diff)
downloadzsh-a0402f795ddb5025036612fa5f70efa8e976e42c.tar.gz
zsh-a0402f795ddb5025036612fa5f70efa8e976e42c.tar.xz
zsh-a0402f795ddb5025036612fa5f70efa8e976e42c.zip
Initial revision
-rw-r--r--Completion/User/_tilde_files38
1 files changed, 38 insertions, 0 deletions
diff --git a/Completion/User/_tilde_files b/Completion/User/_tilde_files
new file mode 100644
index 000000000..6fb393dc5
--- /dev/null
+++ b/Completion/User/_tilde_files
@@ -0,0 +1,38 @@
+#autoload
+
+# Complete files and expand tilde expansions in it.
+
+if (( $argv[(I)-W*] )); then
+ _files "$@"
+ return
+fi
+
+case "$PREFIX" in
+\~/*)
+ IPREFIX="${IPREFIX}${HOME}/"
+ PREFIX="${PREFIX[3,-1]}"
+ _files "$@" -W "${HOME}"
+ ;;
+\~*/*)
+ local user="${PREFIX[2,-1]%%/*}"
+
+ if (( $+userdirs[$user] )); then
+ user="$userdirs[$user]"
+ elif (( $+nameddirs[$user] )); then
+ user="$nameddirs[$user]"
+ else
+ _message "unknown user \`$user'"
+ return 1
+ fi
+ IPREFIX="${IPREFIX}${user%/}/"
+ PREFIX="${PREFIX#*/}"
+ _files "$@" -W "$user"
+ ;;
+\~*)
+ compset -P '?'
+ _users "$@"
+ ;;
+*)
+ _files "$@"
+ ;;
+esac