I have in ~/.zshrc:
SAVED_DIRSTACK=~/.zsh-dir-stack
[[ -f $SAVED_DIRSTACK ]] && . $SAVED_DIRSTACK
trap '
print -r "dirstack=(${(@qq)dirstack})" > $SAVED_DIRSTACK
' EXIT
Exactly how will this work? What I want is a command that will show me the past directories I have cd'ed to. including those from past shells.