I migrated from Bash to Zsh in October and I’m quite thrilled with zsh.
What motivated me to finally move?
- I no longer used the shell within Emacs. If you have a bash setup that works well in Emacs, don’t try to switch. Since moving from emacs bindings to evil-mode, I am quite comfortable in Vim, so I find myself using iTerm way more than the Emacs shell.
- While doing some pair programming with @jakeonrails, I saw the coolness of zsh, which he pointed out to me “was no big deal”, just what’s on the Railscasts Episode on Oh My ZSH.
Tips on Migrating
Here’s a few tips to somebody migrating might find useful:
- Try out oh-my-zsh and take a look at the themes examples. The themes seem to be all customizations of the prompt. I’ll share what I came up with at the bottom, which is a modification of the default robbyrussell theme.
- While most of your bash code will migrate as-is, this is a good time to clean up some cruft in your files. I like to organize my shell code into small files, each with a particular theme, and then have the .zshrc source those, rather than having a giant .zshrc file.
- The oh-my-zsh plugins are way for you to share shell configuration with other members of the community. It’s simple to read what those plugins are doing. Many are just setting aliases. I started to migrate my own configuration code by converting to plugins, but then I realized that that’s overkill. If I ever want to share the configuration, at that point, I can convert to a plugin, which is quite simple.
- If you have any shell functions that use
[, you might have escape that character for zsh.
- If you install zsh plugins, be very careful with any newly installed aliases
from the plugins. I previously had
glaliased as ‘git log’ and the git plugin uses
git pull, which caused me a huge headache when I ran that within my octopress branch.
- You need to escape the
^character for commands such as
git reset HEAD\^
In the third line of this function, I had to escape the
[ and the
1 2 3 4 5 6 7 8 9 10
My new zsh prompt
To set this up, I created a custom theme called justin808 by doing the following:
- Create a theme file
oh_my_zsh/custom/justin808.zsh-theme. See below.
- Export the theme name.
This is what it looks like in my .zshrc file. The first line is because I moved my ZSH configuration files.
Here is my theme file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
This is a companion discussion topic for the original entry at http://www.railsonmaui.com//blog/2014/01/04/migrating-from-bash-to-zsh/