Switching to the Z shell
I’ve recently switched to Zsh from BASH. I switched after Cookie had demonstrated it for me — I immediately saw one great feature: Zsh can handle a prompt on the right-hand side of the screen. The prompt is managed intelligently by Zsh, so that it temporarily removed if it gets in the way. I use my right prompt to show the current working-directory. When I’m working in a deeply-nested directory, this string can get quite long and take up much of the line-width. Before using Zsh, I also had my working-directory on the right of the line. But this was done by an ugly hack, as BASH doesn’t support such a prompt. The result was that my display would become garbled if I overwrote some of the right prompt. It was a mess!
The switch was done without any problems. I had to move the contents of my
~/.bash*
files into the corresponding ~/.zsh*
files — no problem.
But I’ve also gone a step further and I’m now using the powerful
completion-features of Zsh. I’ve added these two
lines to my ~/.zshrc
:
autoload -U compinit compinit
This initializes the completion-code which makes
Zsh much more intelligent. Instead of always
suggesting all files in the current directory, I’ll now only see
directories after cd
, manual-pages after man
, compressed files after
gunzip
, and so on. It also knows about the valid options for a lot of
programs like cvs
, dvips
, etc. All this only slows things down a
little bit, thanks to Zshs ability to load the
code automatically when needed. So it’s only when I try to complete an
option to cvs
that Zsh actually loads the
necessary code.
So — Zsh is a great shell. Compared to other
shells (well, compared to BASH) I
think it’s much more advanced. I always thought that man bash
was big,
but that’s only until you try man zsh
. That tells you that the manual
has been split out into 11 different sections because of the many features
:-) And each of these sections is rather big by itself…
John:
How is the Z shell working? Still using it?
19 February 2010, 8:08 pm