2294bae06a27166dab9cebea60e76fb9de12d3d3

Author
Marc Cornellà <marc.cornella@live.com>
Committer
Marc Cornellà <marc.cornella@live.com>
Date

Message

Merge branch 'shrink-path-chpwd-fix'

Closes #5930.

Diff

 1diff --git a/plugins/shrink-path/shrink-path.plugin.zsh b/plugins/shrink-path/shrink-path.plugin.zsh
 2index 6dd6a930f751cefa883696e193b575b5ebf6703e..e7eed1705077c795cf7b8200d737916eec153e22 100644
 3--- a/plugins/shrink-path/shrink-path.plugin.zsh
 4+++ b/plugins/shrink-path/shrink-path.plugin.zsh
 5@@ -94,18 +94,12 @@ shrink_path () {
 6         (( tilde )) && dir=${dir/$HOME/\~}
 7         tree=(${(s:/:)dir})
 8         (
 9-                # unset chpwd_functions since we'll be calling `cd` and don't
10-                # want any side-effects (eg., if the user was using auto-ls)
11-                chpwd_functions=()
12-                # unset chpwd since even if chpwd_functions is (), zsh will
13-                # attempt to execute chpwd
14-                unfunction chpwd 2> /dev/null
15                 if [[ $tree[1] == \~* ]] {
16-                        cd ${~tree[1]}
17+                        cd -q ${~tree[1]}
18                         result=$tree[1]
19                         shift tree
20                 } else {
21-                        cd /
22+                        cd -q /
23                 }
24                 for dir in $tree; {
25                         if (( lastfull && $#tree == 1 )) {
26@@ -122,7 +116,7 @@ shrink_path () {
27                                 (( short )) && break
28                         done
29                         result+="/$part"
30-                        cd $dir
31+                        cd -q $dir
32                         shift tree
33                 }
34                 echo ${result:-/}