Stefan's thoughts on stuff

This is exciting!

Oct 3, 2016 - 2 minute read - Comments - zsh

Moving To zsh

The time has finally come to try zsh after observing a few of my colleagues doing some fancy things on their terminals.

Installation

The following section contains instruction on how I set up my home computer and my work laptop.

Gentoo

To install on my Gentoo system:

emerge -av app-shells/zsh app-shells/gentoo-zsh-completions

Make it permanent

chsh --shell /bin/zsh

Enable global auto completion by adding zsh-completion to USE in /etc/portage/make.conf and rebuild emerge -auN @world

Mac

To install on my Mac:

brew install zsh zsh-completions

Make it permanent

First, add /usr/local/bin/zsh to /etc/shells, then:

chsh -s /usr/local/bin/zsh

Oh My Zsh

Now that we have ZSH installed it is time to tailor it to our needs.

Oh My Zsh is a framework for managing your zsh configuration and comes with numerous plugins and themes to enhance zsh.

This installs Oh My Zsh files to ~/.oh-my-zsh:

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Configuration

Theme

Now for the fun part, choose from one of the plentiful Themes. Once you have found one you like, modify ZSH_THEME in ~/.zshrc.

ZSH_THEME="bira"

Plugins

There are A LOT of Plugins to choose from too. Adapt the plugins variable in ~/.zshrc to your needs.

plugins=(git git-prompt git-extras docker brew gradle mvn vagrant kubectl)

Fix git-prompt

Somehow, despite having added git-prompt to my plugins, it did not work out of the box. The least intrusive way to work around this was to add the following:

$ cat ~/.oh-my-zsh/custom/git-prompt-fix.zsh                                                                                           1 ↵
function git_prompt_info() {
    git_super_status
}

Sources

Tags: zsh gentoo mac

Cheat Sheet

comments powered by Disqus