fb6738a7e1d476ec9a74b0e8a04f5252f9de91fe

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

Message

last-working-dir: don't jump if not in $HOME

Diff

 1diff --git a/plugins/last-working-dir/last-working-dir.plugin.zsh b/plugins/last-working-dir/last-working-dir.plugin.zsh
 2index c5278d64034381d552a6fc29096a22b422eadb59..e882b288f21d9ccd5a9febc37230c6c84a7b4c36 100644
 3--- a/plugins/last-working-dir/last-working-dir.plugin.zsh
 4+++ b/plugins/last-working-dir/last-working-dir.plugin.zsh
 5@@ -14,8 +14,10 @@ lwd() {
 6 	[[ -r "$cache_file" ]] && cd "$(cat "$cache_file")"
 7 }
 8 
 9-# Automatically jump to last working directory unless this
10-# isn't the first time this plugin has been loaded.
11-if [[ -z "$ZSH_LAST_WORKING_DIRECTORY" ]]; then
12-	lwd 2>/dev/null && ZSH_LAST_WORKING_DIRECTORY=1 || true
13-fi
14+# Jump to last directory automatically unless:
15+# - this isn't the first time the plugin is loaded
16+# - it's not in $HOME directory
17+[[ -n "$ZSH_LAST_WORKING_DIRECTORY" ]] && return
18+[[ "$PWD" != "$HOME" ]] && return
19+
20+lwd 2>/dev/null && ZSH_LAST_WORKING_DIRECTORY=1 || true