Tag | zshell

Zsh Completion Magic

Dec 1st, 2009No Comments

I’m a happy user of zsh for a few years now and, while I don’t know all the subtleties of it, I find it a indispensable tool. People I know and respect keep asking me “Why not bash?” One of the big reasons is zsh’s completion system.

Bash has a add-on version of this, called bash-completion, and I used that before moving over to zsh full-time. Bash-completion feels, well, added on and slow and not always working. Zsh’s completion, however, keeps surprising me on how much it does do. As they say, a picture is worth a thousand words.

ZSH doing Django Completion

I typed "./manage.py TAB" and Zsh gave me all the arguments of a standard Django manage script.

The above screenshot came with no configuration — I didn’t have to tell zsh about Django because, well, someone already did. And I’m glad for it.

It’s not just for Django, either. See what happened when I did “./configure <TAB>” in PHP’s source tree:

Zsh when configuring soruce

The top part is what I got when I did "./configure TAB". The part below my prompt is what I got when I did "./configure –with-TAB"

So note that zsh helps me figure out the right options.  What I want to know the exact options for MySQL?

Results of ./configure --with-mTAB

Results of ./configure –with-mTAB

Again, none of this stuff had to be configured — I just told zsh I wanted completion and it gave it to me. I didn’t have to tell it that this was a configure script — it knew that! Just like it knew about the Django script.

This is just a taste. I hope you bite into zsh for more goodness.

How to stop zshell from dumping

Jun 12th, 2009No Comments

I fixed this once couple years ago, with more than a little guidance from the ZSH-Users list.  But it started happening to me again a few weeks ago and I couldn’t remember how I fixed it. After searching through my GMail this morning, I found it.  Maybe if I put it here I will remember how to fix it next time.  And maybe help someone else.

This only happens to me when I use zsh  via Cygwin (I also use zsh on OSX and Linux).  What happens is that when zsh hits compinit in my ~/.zshrc, it prints a ton of the built-in functions to standard error and that’s it.  No error, no complaints . . . and no completion.  None at all!  See this article for a decent idea on how wonderful zsh does completion.

The fix is easy — manually remove ~/.zcompdump and manually run compinit. That instance of compinit will complete fine.  Then start a new shell and you are good to go!  Note that you have to manually run compinit – just starting a new shell won’t fix it.

I’m not sure why my ~/.zcompdump keeps getting corrupted . . . maybe because my home directory is on a shared drive?