601d4d6efc3babed55cbf90252538080089dcfa5

Author
Robby Russell <robby@planetargon.com>
Committer
Robby Russell <robby@planetargon.com>
Date

Message

Merge pull request #1662 from rylwin/patch-1

last-working-dir: Use >! to overwrite $cache_file

Diff

 1diff --git a/plugins/last-working-dir/last-working-dir.plugin.zsh b/plugins/last-working-dir/last-working-dir.plugin.zsh
 2index 190bc279d505cc9c985023f10a12ee694dbd3067..ccf0f5b22afa8f80a4f6fd49a1f9217208ae78b8 100644
 3--- a/plugins/last-working-dir/last-working-dir.plugin.zsh
 4+++ b/plugins/last-working-dir/last-working-dir.plugin.zsh
 5@@ -9,7 +9,8 @@ local cache_file="$ZSH/cache/last-working-dir"
 6 
 7 # Updates the last directory once directory is changed.
 8 function chpwd() {
 9-	echo "$PWD" > "$cache_file"
10+  # Use >! in case noclobber is set to avoid "file exists" error
11+	echo "$PWD" >! "$cache_file"
12 }
13 
14 # Changes directory to the last working directory.