PPL30 Day 22: ZSH

Today I’ve been playing with ZSH. Many people seem to graduate to ZSH from bash, so I’d like to find out why. I am a bit worried, as I run a fairly extensive, heavily customized bash environment. What am I going to lose? Do I have to give up my vi editing mode? My functions and aliases? What do I get in return? Will ZSH make me breakfast?

breakfast machine

This is part of the Peer Pressure Learning 30 series. To learn more about what in the hell that means, see the intro to the series, A Good Time To Learn.

Resources

Oh My ZSH

Oh My ZSH is a collection of useful things (functions, aliases, etc) for use with ZSH. Really, it’s a fantastic way to get up and running quickly with more than the barebones. I highly recommend starting with it. You can customize on top of it. You can always pull what you like out of it and maintain your own set of files, rather than rely upon oh-my-zsh in the future.

Z Shell Site

Of course we don’t want to forget about the home page for ZSH. Though it’s not much to look at, it’s got links to documentation, FAQs, other resources (including the wiki), and more.

Intro to ZSH

The Intro to ZSH by Paul Falstad is a good place to start to learn some of the more basics of ZSH, so that you might feel right at home when you dive in.

What I Think I Now Know

What I know for sure is that I’m unsure what I think of ZSH.

I do have ‘vi’ mode! That is a good thing. I was worried that I would yearn for it, causing me to switch back to bash sooner than later without it. Luckily, it was as simple as running bindkey -v. However, I am missing one related feature: In bash, when in command mode, I can press v to open the current command in my editor (vim, of course). I can then edit the command, and close the editor when I’m finished, the result replacing the half-finished command with which I started. This is extremely useful for complicated commands that could use some more flexible editing – above and beyond what vi mode offers. Perhaps I won’t miss it. We’ll see.

I also am able to use most of my aliases and functions. I haven’t yet figured out how to replace bash’s complete command, which I’m using in a few of my git aliases. There are a few other instances where I’m using something very bash specific. They aren’t show-stoppers, and I’m confident I can get the equivalent done in ZSH. It has been relatively painless, and I’m very encouraged that most things just work.

I really haven’t had enough time to truly learn much of anything about ZSH, or how whether I prefer it to bash. I know that I like some of its features, in theory, such as its file-globbing features. I mostly like its typo correction, though it has already annoyed me once; I tried to make a directory, and it asked me if I wasn’t sure that I meant to type the path to a directory that already exists. That seemed more naive than I would’ve expected it to be.

I’ll know soon enough whether I prefer ZSH to bash, though, as I plan to continue using it for the next few days. I welcome any and all tips and tricks!

… Note that it didn’t make me breakfast. I had to pour my own raisin bran and milk, and I had to get my own glass of water. Bash didn’t make me breakfast, either, but I expected more out of ZSH.