zsh Tips and Tricks
May 04 2011 15:00 CET
Some time ago I switched from bash to zsh on my Mac.
zsh gives you a lot of nice features that is missing from bash, such as way better completion (better than bash_completion).
If you wanna get started with zsh I especially recommend oh-my-zsh which is a set of predefined functions, autocomplete helpers etc.
A few nifty tips for your .zshrc is the following which I really can’t live without:
bindkey "^[[3~" delete-char
bindkey "^[[5D" backward-word
bindkey "^[[5C" forward-word
# No autocorrect
unsetopt correct_all
The above enables the delete key to work correctly, but also enabled you to use CTRL+Arrows to skips words forwards and backwards.
The autocorrect feature of zsh can be seen as a nice feature but after I while I got pretty annoyed with it.
Lastly I want to point out functions which can be defined directly in your .zshrc (or .bashrc since it will work in bash aswell).
For example I have the following function that moves torrent files to my WDTVLive rtorrent folder. Note that functions defined here will work with autocomplete, hence the long but descriptive name.
# Torrents
function move_torrents_to_wdtv() {
scp /Users/mmr/Downloads/*.torrent wdtv:/tmp/rt/rtorrent/torrents
rm /Users/mmr/Downloads/*.torrent
}