shrink-path: match only the beginning of the directory (#6862)

Fixes #6317
This commit is contained in:
Marc Cornellà 2018-05-26 19:31:17 +02:00 committed by GitHub
parent 2294bae06a
commit 5896c87155
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -88,10 +88,10 @@ shrink_path () {
if (( named )) {
for part in ${(k)nameddirs}; {
[[ $dir == ${nameddirs[$part]}(/*|) ]] && dir=${dir/${nameddirs[$part]}/\~$part}
[[ $dir == ${nameddirs[$part]}(/*|) ]] && dir=${dir/#${nameddirs[$part]}/\~$part}
}
}
(( tilde )) && dir=${dir/$HOME/\~}
(( tilde )) && dir=${dir/#$HOME/\~}
tree=(${(s:/:)dir})
(
if [[ $tree[1] == \~* ]] {