Your browser (Internet Explorer 6) is out of date. It has known security flaws and may not display all features of this and other websites. Learn how to update your browser.
Zsh niceties

Zsh niceties

I am using the zsh forever now, today I stumbled upon mikas advent calendar where he lists a lot of zsh niceties. I list some of them here so that I can find them later on. All below is me paraphrasing nikas wisdom. You obviously want to put most of this into your .zshrc.


Hashes are very useful shortcuts:

$ hash -d prog=~/Desktop/Programming
$ cd ~prog # or just ~prog


This one is most useful too! Add the following lines to your .zshrc and in the future, just hit Esc-e to edit your current command line.

in your $EDITOR:

autoload -U edit-command-line
zle -N edit-command-line
bindkey '\ee' edit-command-line


I haven't heard before of vcs_info before, but if you use git or mecurial, this one is really valuable. It is also mighty slow with bzr and might clobber your console with debug output, but give it a try. You need to adjust PS1 to your needs.

autoload -Uz vcs_info
zstyle ':vcs_info:*' disable cdv darcs mtn svk tla

precmd() {
  [[ -n $vcs_info_msg_0_ ]] && psvar[1]="$vcs_info_msg_0_"

PS1="%B%(?..[%?] )%b%n@%U%m%u%(1v.%F{green}%1v%f.)> "


I tend not to use globbing this much, except for the usual stuff like ls */**/*.py or so, but zsh's globbing features are definitively worth a checkout.