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.
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.
Sign up to join this communityWithout 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.
(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
.
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