diff --git a/plugins/last-working-dir/last-working-dir.plugin.zsh b/plugins/last-working-dir/last-working-dir.plugin.zsh index e882b288f..53bb19e46 100644 --- a/plugins/last-working-dir/last-working-dir.plugin.zsh +++ b/plugins/last-working-dir/last-working-dir.plugin.zsh @@ -4,8 +4,10 @@ typeset -g ZSH_LAST_WORKING_DIRECTORY # Updates the last directory once directory is changed chpwd_functions+=(chpwd_last_working_dir) chpwd_last_working_dir() { - local cache_file="$ZSH_CACHE_DIR/last-working-dir" - pwd >| "$cache_file" + if [ "$ZSH_SUBSHELL" = 0 ]; then + local cache_file="$ZSH_CACHE_DIR/last-working-dir" + pwd >| "$cache_file" + fi } # Changes directory to the last working directory