diff options
author | Tanaka Akira <akr@users.sourceforge.net> | 2000-02-25 15:52:40 +0000 |
---|---|---|
committer | Tanaka Akira <akr@users.sourceforge.net> | 2000-02-25 15:52:40 +0000 |
commit | 45636537243ff0bcafc8103e3b49bdfc12cd3d31 (patch) | |
tree | a6b171d66089850fea472ea26067c2611f362f59 | |
parent | a1ffd9dd8280300b3b4c9b026d9c2199d465355f (diff) | |
download | zsh-45636537243ff0bcafc8103e3b49bdfc12cd3d31.tar.gz zsh-45636537243ff0bcafc8103e3b49bdfc12cd3d31.tar.xz zsh-45636537243ff0bcafc8103e3b49bdfc12cd3d31.zip |
zsh-workers/9880
-rw-r--r-- | Completion/Core/_path_files | 16 |
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#*/}" |