Wednesday, October 27, 2010

Two ZSH conventions for switchers from BASH

When starting to learn UNIX, I enjoyed with the well-designed Debian 3.1 and the bash completions coming with it. At that time the ZSH on Debian wasn't well configured for a newbie having no direction in dark.

Actually, the ZSH was set as a handy tool on recent releases of Debian-like system. For a longtime user of BASH, the default setting of backward-kill-word is confusing: it never stop with DASH, UNDERSCORE, and SLASH, etc. However, it's easy to modify the action through manipulate the $WORDCHARS variable which including all chars treated as alphabet in ZSH. For example,
export WORDCHARS=${WOARCHARS:s/-//}
exclude the dash sign from $OWRDCHARS, or you can just export the $WORDCHARS you want.

The second is ZSH can only auto-completed from first choice to the final by default. Adding bindkey '^[[Z' reverse-menu-complete to ~/.zshrc makes me not being afraid of pressing tab too fast.

References:
[1] stackoverflow.com
[2] zsh mailing list

No comments: