Last Updated: February 25, 2016
·
1.117K
· l3kn

Simplify zsh's directory history

1. Add this function to your .zshrc

function xd() {
  if [ -z "$1" ]
  then
    dirs -v
  else
    ~$1
  fi
}

2. Reload it

$ . ~/.zsh

3. Awesome!

Move around

$ cd foo

Use xd to view your history

$ xd
0    ~/foo
1    ~

Add a number to to change your current directory

$ xd 0
$ pwd
~