Wednesday, June 25, 2014

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:

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.

1 comment:

David said...

Thanks for sharing. I never saw what was the deal with zsh until I went through the presentation. At first I was unimpressed by the things it did, but later on? That's really handy!