Have used bash for 6+ years, I finally decided to switch to zsh. This is not my first time trying zsh tho, last time I tried zsh I believe oh-my-zsh is not out or very popular yet, somehow zsh seems doesn’t impressive me a lot. Probably at that time I still feel strong tied to bash somehow, habit, workflow, autocompletion style etc.
Yesterday I tried to give zsh one more chance, thanks to oh-my-zsh and peepcode, this time the exprience is much more better than last time, I managed to reuse most of my bash configuration when I can try the new features of zsh, which is pretty good for my transition and the habit I already get used to in bash in the past.
Zsh users love to share their prompt, to follow their tradition, I’m going to do that here as well, below is my Zsh prompt screenshot:
The idea is mostly inspired from topfunky’s zsh-simple, except that I used the dark background and customized some of the colors.
Below is the configuration section in ~/.zshrc:
autoload -U colors
To reuse bash configurations and make your transition more smooth and enjoyable, oh-my-zsh is highly recommended. I used the manual way to install it, cuz I need to make some customizations about the default installation configurations.
$ cp ~/.zshrc ~/.zshrc.orig
$ cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
Instead of making zsh the default shell of my system, I started zsh in ~/.bashrc
# start zsh
The reason to start a new zsh process instead of “exec zsh -l” is I could still fall back to bash by just typing “exit” when needed, pretty convenient.
Customized the oh-my-zsh .zshrc file and append my previous zsh configuration to it after installation.
oh-my-zsh has plenty of built-in plugins available for your daily usage, below is a list of plugins that I’m evaluating:
I use RVM, below command is needed in ~/.zshrc
if [[ -s ~/.rvm/scripts/rvm ]] ; then source ~/.rvm/scripts/rvm ; fi
I’d like to use upper arrow and down arrow to search the shell history which matches my current typed word, below is the needed configuration for zsh since it doesn’t use readline (~/.inputrc) as bash does. oh-my-zsh has a slightly different configuration but I like mine below more cuz that’s what I already get used to in my bash configruation before.
bindkey '^[[B' history-beginning-search-forward
[Bash History Migration]
Speaking of history search, it’s better if we can reuse the bash history I had before, fortunately it’s not a hard job with the help of google. Seems someone already did this before, I just stole their solution which works perfectly for me.
$ cat ~/.zsh_history >> /tmp/zsh_history
$ mv /tmp/zsh_history ~/.zsh_history
As people always say “just do it”, probably so far the conclusion for zsh for me is “just use it”
- [2013-8-22] 慢下来