Hacker News new | ask | show | jobs
by bretthopper 5593 days ago
No mention of ZSH directory stacks yet? http://www.acm.uiuc.edu/workshops/zsh/dir_stack.html

Some helpful aliases to manage them:

alias 1='cd -1'

alias 2='cd -2'

alias 3='cd -3'

alias 4='cd -4'

alias 5='cd -5'

alias 6='cd -6'

alias 7='cd -7'

alias d='dirs -v'

alias h='history'

alias j='jobs'

Just one of the many reasons to use ZSH.

4 comments

Just one of the many reasons to use ZSH.

What shell doesn't have a directory stack?

What's the bash equivalent to zsh's "setopt autopushd"?
I don't know what that is, but does it do more than alias cd='pushd'?
That's essentially what it does, but if you use the "autocd" option as well, you don't need to type "cd" - you can just use the name of a directory as a command. So, "autopushd" would ensure that these operations use the directory stack also.
sh
I have bound 'pushd -1' to PgUp.

    function directory_up { 
      pushd -1
      zle reset-prompt 
    }
    zle -N directory-up directory_up
    bindkey "\e[5~" directory-up
Ditto for "pushd +0" and PgDn.
How about `setopt cdablevars`?

    setopt cdablevars
    proj=$HOME/Projects
    cd proj
    pwd # => /Users/sjs/Projects
nice stuff. You got your dotfiles on a github?
I know you didn't ask me, but you might find something you like here: https://github.com/samsonjs/config (dot files) and https://github.com/samsonjs/bin
appreciated, thanks!