busy-bee.net buzz buzz buzz goes the honeybee home | blog | links | about me

linux to an imac

2002-08-22 20:50 / zsh, zsh, zsh  »

I'll rant one more time about this. Why bother changing shells, from the default tcsh to anything else? Well it's pointless unless you use the Terminal, of course. If you do though, and you're like me, and you like saving precious key-strokes (M-/ in emacs is yum-yum), then the first time you see someone contextually tab-complete in zsh, you'll be amazed.

tcsh and bash (coming in Jaguar, the default in linux) both auto-complete on commands. Type ni <tab> and you'll get a list of the commands starting with 'ni'. But zsh auto-completes on arguments to commands as well. Type cd <tab> and you'll get a list of directories - and only directories - that you can cd to. Type cvs -d <tab> and you get a list of the cvs repositories you've used in the past; man <tab> man pages; perldoc <tab> perldocs; and so on and so on. With cvs and the secure shell suite, it'll even connect to the remote server and auto-complete from there. So if you don't know the repositories you can access it'll find them for you. As I didn't for Apple (screenshot large, small).

Prettiness is another reason to switch. zsh has 'themed' prompts. Whereas - at least last time I tried - in bash if you want to change the colours or strings shown in your prompt, you have to either hack ~/.bashrc or else mess about writing shell functions, in zsh you just type prompt <promptname> <colour1> .. <colourn>, where promptname switches what gets shown and the colours switch the colours for the various parts (syntax, hostname, history number). (Screenshot large, small.) The colour change is particularly useful when you're switching hosts a lot within the same term.

Anyway, what to do if you're remotely interested? First you need to download and compile the latest distribution from www.zsh.org, because the default version with OS X doesn't seem to have all this nonsense compiled. Then, fetch my slightly hacked (e.g. no call to /bin/false) set of resource files, and extract into your home directory. I've included my .zsh_prompts which - whoopee - shows the version of Darwin and OS X you're using. Then, try zsh, try the tabbing stuff, and if you like it you can permanently change your shell. If it doesn't work (make sure it's the new version that you're calling, probably in /usr/local/bin), mail me and I'll try to help.

mod_perl -- Speed, Power, Scalability