diff options
author | Axel Beckert <abe@deuxchevaux.org> | 2013-11-07 14:52:31 +0100 |
---|---|---|
committer | Axel Beckert <abe@deuxchevaux.org> | 2013-11-07 14:52:31 +0100 |
commit | d799ac78a744a5359563af55b4dee9e91255a1dc (patch) | |
tree | 73475ed7089e6ee050085a96b88018994b43bdfc /Completion/Zsh/Command/_cd | |
parent | abfb3b136a4ad5b2832fb7d920442a2bb28c0697 (diff) | |
parent | 375115c7dfd6dff576915d25fe2ecdd381dd9d81 (diff) | |
download | zsh-d799ac78a744a5359563af55b4dee9e91255a1dc.tar.gz zsh-d799ac78a744a5359563af55b4dee9e91255a1dc.zip |
Merge branch 'upstream' into debian
Diffstat (limited to 'Completion/Zsh/Command/_cd')
-rw-r--r-- | Completion/Zsh/Command/_cd | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/Completion/Zsh/Command/_cd b/Completion/Zsh/Command/_cd index 476947f60..a5d328fc5 100644 --- a/Completion/Zsh/Command/_cd +++ b/Completion/Zsh/Command/_cd @@ -51,6 +51,18 @@ else _directory_stack && ret=0 fi + local -a tmpWpath + if [[ $PREFIX = (|*/)../* ]]; then + local tmpprefix + # Use cd in a subshell to properly [not] resolve symlinks + tmpprefix=$(cd ${PREFIX%/*} >&/dev/null && print $PWD) + if [[ -n $tmpprefix ]]; then + tmpWpath=(-W $tmpprefix) + IPREFIX=${IPREFIX}${PREFIX%/*}/ + PREFIX=${PREFIX##*/} + fi + fi + if [[ $PREFIX != (\~|/|./|../)* ]]; then local tmpcdpath alt @@ -88,7 +100,7 @@ else # already handled by _command_names (see _autocd) [[ CURRENT -ne 1 || ( -z "$path[(r).]" && $PREFIX != */* ) ]] && - alt=( "${cdpath+local-}directories:${cdpath+local }directory:_path_files -/" "$alt[@]" ) + alt=( "${cdpath+local-}directories:${cdpath+local }directory:_path_files $tmpWpath -/" "$alt[@]" ) if [[ CURRENT -eq argstart && noopts -eq 0 && $PREFIX = -* ]] && zstyle -t ":completion:${curcontext}:options" complete-options; then @@ -100,7 +112,7 @@ else return ret fi [[ CURRENT -ne 1 ]] && _wanted directories expl directory \ - _path_files -/ && ret=0 + _path_files $tmpWpath -/ && ret=0 return ret fi |