Migrating from bash to zsh
These are my steps in migration from bash to zsh. I’m documenting these to keep the future reference for me (and possibly other readers as well).
Motivation?
Check out the Slideshare presentation: Why Zsh is Cooler than Your Shell
Current shell
to find out the current shell:
ps -p $$
it’s useful during migration to make sure the new shell is really in use.
Migration
Migration itself included (on my Fedora) reconfiguring:
- default shell: (inspired by: http://unix.stackexchange.com/questions/39881/running-chsh-does-not-change-shell)
chsh -s /bin/zsh
- konsole: in
Settings
->Edit Current Profile
for:Shell
type:/bin/zsh
- gnome-terminal: no changes required, seems to go for the default shell.
- xterm: no changes required, seems to go for the default shell.
- tmux: (from: http://superuser.com/questions/253786/how-can-i-make-tmux-use-my-default-shell)
in the:~/.tmux.conf
added:set-option -g default-shell /bin/zsh
oh-my-zsh
There exists users’ maintained collection of zsh
customizations, that I found useful. Called: oh-my-zsh. (Please note the amazing Github’s – Star count. Once seeing that I didn’t doubt I’ll give it a try.)
For installation I just went for:
curl -L http://install.ohmyz.sh | sh
oh-my-zsh with powerline
I’m used to powerline everywhere ((g)vim
/konsole
/tmux
/bash
) already, so let’s keep it working in zsh
as well.
I created file: ~/.oh-my-zsh/custom/powerline.zsh
with contents:
. ~/.local/lib/python2.7/site-packages/powerline/bindings/zsh/powerline.zsh
Please note: You need to go for the actual location of powerline
installation on your system.
and in the file: ~/.zshrc
I had to comment out line:
# ZSH_THEME="robbyrussell"
otherwise oh-my-zsh
theme seems to conflict with powerline
one.
oh-my-zsh plugins
The real benefit of oh-my-zsh
commes with plugins, so I went for those I find useful. Via changing the file: ~/.zshrc
having:
plugins=(git mvn glassfish yum colored-man vagrant z common-aliases gradle)
oh-my-zsh custom stuff
As my ~/.bashrc
held already quite some customizations, I migrated those to:
~/.oh-my-zsh/custom/*.zsh
Even this part was nice, as I could tidy up things a bit and omit unused stuff. Moreover I decided to create multiple *.zsh
files (as these are auto-loaded) to achieve modularity.
Done
Honestly in the beginning, I had no clue how much I would enjoy my new shell.
Reference: | Migrating from bash to zsh from our SCG partner Peter Butkovic at the pb’s blog about life and IT blog. |