From 3dab7e46e8815838c8099040e11a7ae9a30ba03d Mon Sep 17 00:00:00 2001 From: dt-rush Date: Thu, 17 May 2018 08:45:04 -0400 Subject: [PATCH] unset chpwd_functions before running cd to work with the path, to avoid side-effects if the user has set any chpwd_functions which cause output, such as is the case if the user is using auto-ls (#6830) --- plugins/shrink-path/shrink-path.plugin.zsh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/shrink-path/shrink-path.plugin.zsh b/plugins/shrink-path/shrink-path.plugin.zsh index f111962a..6dd6a930 100644 --- a/plugins/shrink-path/shrink-path.plugin.zsh +++ b/plugins/shrink-path/shrink-path.plugin.zsh @@ -94,6 +94,11 @@ shrink_path () { (( tilde )) && dir=${dir/$HOME/\~} tree=(${(s:/:)dir}) ( + # unset chpwd_functions since we'll be calling `cd` and don't + # want any side-effects (eg., if the user was using auto-ls) + chpwd_functions=() + # unset chpwd since even if chpwd_functions is (), zsh will + # attempt to execute chpwd unfunction chpwd 2> /dev/null if [[ $tree[1] == \~* ]] { cd ${~tree[1]}