Skip to content

Instantly share code, notes, and snippets.

@jonleighton
Created August 31, 2019 23:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonleighton/1f0b96b49247a07dbaa30fbbe70b34f7 to your computer and use it in GitHub Desktop.
Save jonleighton/1f0b96b49247a07dbaa30fbbe70b34f7 to your computer and use it in GitHub Desktop.
# save path on cd (chpwd is a zsh hook)
function chpwd {
pwd > ~/.last_dir
}
# restore last saved path on launch
if [[ -f ~/.last_dir ]]; then
cd $(cat ~/.last_dir)
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment