Skip to content

Instantly share code, notes, and snippets.

@dasgib
Created December 20, 2011 10:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dasgib/1501148 to your computer and use it in GitHub Desktop.
Save dasgib/1501148 to your computer and use it in GitHub Desktop.
pathed_cd for zsh - start new shell in last used directory
pathed_cd () {
if [ x"$1" = x ]; then
cd
else
cd "$1"
fi
pwd > ~/.cdpath
}
alias cd="pathed_cd"
if [ -f ~/.cdpath ]; then
cd $(cat ~/.cdpath)
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment