1

Without Oh-My-Zsh, I can pushd two identical path:

$ dirs
~
$ pushd Desktop
Desktop ~
$ pushd ~
~ Desktop ~

With Oh-My-Zsh:

$ dirs
~
$ pushd Desktop
Desktop ~
$ pushd ~
~ Desktop

How do I disable this? I want the original Zsh behavior.

4

(Insprired by this answer) It is set in $ZSH/lib/directories.zsh:

setopt auto_pushd
setopt pushd_ignore_dups

auto_pushd makes cd behave the same as pushd. However, this would result in an directory stack overflow if you keep changing directory, so they set pushd_ignore_dups as well, to limit the stack. This is not a problem for me, since I disabled auto_pushd.

Therefore, add unsetopt pushd_ignore_dups in ~/.zshrc.

Reference

  • So how are you use, i.e. cd into, a directory on the stack now? – the_velour_fog Jul 26 '16 at 0:29
  • @the_velour_fog Sorry, I don't do that in my daily workflow... I do not heavily rely on the directory stack feature. I pushd only when I need to poke to some directory to see some distant folder (e.g. /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/ in OS X), then popd back real quick. If I need to frequently switch between two directory for long, I prefer to open another tab for it. – Franklin Yu Jul 26 '16 at 0:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.