1diff --git a/plugins/last-working-dir/last-working-dir.plugin.zsh b/plugins/last-working-dir/last-working-dir.plugin.zsh
2index c458464ce32a7e3734bf2738f42a41e7e717ceab..c5278d64034381d552a6fc29096a22b422eadb59 100644
3--- a/plugins/last-working-dir/last-working-dir.plugin.zsh
4+++ b/plugins/last-working-dir/last-working-dir.plugin.zsh
5@@ -1,26 +1,21 @@
6-#!/usr/bin/env zsh
7-# Keeps track of the last used working directory and automatically jumps
8-# into it for new shells.
9-
10-# Flag indicating if we've previously jumped to last directory.
11+# Flag indicating if we've previously jumped to last directory
12 typeset -g ZSH_LAST_WORKING_DIRECTORY
13-mkdir -p $ZSH_CACHE_DIR
14-cache_file="$ZSH_CACHE_DIR/last-working-dir"
1516-# Updates the last directory once directory is changed.
17+# Updates the last directory once directory is changed
18 chpwd_functions+=(chpwd_last_working_dir)
19-function chpwd_last_working_dir() {
20- # Use >| in case noclobber is set to avoid "file exists" error
21+chpwd_last_working_dir() {
22+ local cache_file="$ZSH_CACHE_DIR/last-working-dir"
23 pwd >| "$cache_file"
24 }
2526-# Changes directory to the last working directory.
27-function lwd() {
28- [[ ! -r "$cache_file" ]] || cd "`cat "$cache_file"`"
29+# Changes directory to the last working directory
30+lwd() {
31+ local cache_file="$ZSH_CACHE_DIR/last-working-dir"
32+ [[ -r "$cache_file" ]] && cd "$(cat "$cache_file")"
33 }
3435-# Automatically jump to last working directory unless this isn't the first time
36-# this plugin has been loaded.
37+# Automatically jump to last working directory unless this
38+# isn't the first time this plugin has been loaded.
39 if [[ -z "$ZSH_LAST_WORKING_DIRECTORY" ]]; then
40 lwd 2>/dev/null && ZSH_LAST_WORKING_DIRECTORY=1 || true
41 fi