summaryrefslogtreecommitdiffstats
path: root/Completion/Core
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>2000-02-25 15:52:40 +0000
committerTanaka Akira <akr@users.sourceforge.net>2000-02-25 15:52:40 +0000
commit45636537243ff0bcafc8103e3b49bdfc12cd3d31 (patch)
treea6b171d66089850fea472ea26067c2611f362f59 /Completion/Core
parentzsh-workers/9879 (diff)
downloadzsh-45636537243ff0bcafc8103e3b49bdfc12cd3d31.tar
zsh-45636537243ff0bcafc8103e3b49bdfc12cd3d31.tar.gz
zsh-45636537243ff0bcafc8103e3b49bdfc12cd3d31.tar.bz2
zsh-45636537243ff0bcafc8103e3b49bdfc12cd3d31.tar.lz
zsh-45636537243ff0bcafc8103e3b49bdfc12cd3d31.tar.xz
zsh-45636537243ff0bcafc8103e3b49bdfc12cd3d31.tar.zst
zsh-45636537243ff0bcafc8103e3b49bdfc12cd3d31.zip
zsh-workers/9880
Diffstat (limited to 'Completion/Core')
-rw-r--r--Completion/Core/_path_files16
1 files changed, 13 insertions, 3 deletions
diff --git a/Completion/Core/_path_files b/Completion/Core/_path_files
index 60a266482..a4ba55760 100644
--- a/Completion/Core/_path_files
+++ b/Completion/Core/_path_files
@@ -172,9 +172,19 @@ if [[ "$pre[1]" = \~ ]]; then
# prefix from the string to complete, set `donepath' to build the correct
# paths and make sure that the loop below is run only once with an empty
# prefix path by setting `prepaths'.
-
- linepath="${pre%%/*}/"
- realpath=$~linepath
+
+ linepath="${pre[2,-1]%%/*}"
+ if [[ -z "$linepath" ]]; then
+ realpath="${HOME%/}/"
+ elif (( $+userdirs[$linepath] )); then
+ realpath="${userdirs[$linepath]%/}/"
+ elif (( $+nameddirs[$linepath] )); then
+ realpath="${nameddirs[$linepath]%/}/"
+ else
+ _message "unknown user \`$linepath'"
+ return 1
+ fi
+ linepath="~${linepath}/"
[[ "$realpath" = "$linepath" ]] && return 1
pre="${pre#*/}"
orig="${orig#*/}"