2012-09-09

powerline for zsh

I discovered some time ago vim-powerline a cool semi-graphical status line for vim

Jérémy Romey adapted it for zsh.

You can see here for example if you have any pending files to commit on git in the current git repo of your working directory and the current branch you are on.

Note : this is my slightly adapted version with the international format for the time.

Here is a quick tutorial to install this version.

Safety first ... backup your .zshrc, you never know if you gonna brake something

cd                                                            
cp .zshrc .zshrc.bak

Install and make sure you use a powerline patched font in your terminal.
For example I like Envy R Monaco

Now, simply grab my for of "oh-my-zsh" and copy the config template.

git clone git://github.com/gbin/oh-my-zsh.git ~/.oh-my-zsh
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc

Change the theme to "powerline", add your aliases in your ~/.zshrc, and some plugins. Here is mine.

# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh

# Set name of the theme to load.
ZSH_THEME="powerline"

alias ls='ls --color=auto'
alias ll='ls -l --color=auto'
alias la='ls -A --color=auto'
alias l='ls -CF --color=auto'
alias diff='colordiff'

alias -s gz='tar -xzvf'
alias -s bz2='tar -xjvf'
alias -s zip='unzip'
alias -s txt=$EDITOR
alias -s html=$BROWSER

# Set to this to use case-sensitive completion
# CASE_SENSITIVE="true"

# Comment this out to disable weekly auto-update checks
# DISABLE_AUTO_UPDATE="true"

# Uncomment following line if you want to disable colors in ls
# DISABLE_LS_COLORS="true"

# Uncomment following line if you want to disable autosetting terminal title.
# DISABLE_AUTO_TITLE="true"

# Uncomment following line if you want red dots to be displayed while waiting for completion
# COMPLETION_WAITING_DOTS="true"

# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
plugins=(git github pip python)

source $ZSH/oh-my-zsh.sh

Open a new terminal and boom, it should work. Awesome no ?

1 comment:

  1. This might be too late... But THANKS! This works just out of the box.

    I tried the powerline-zsh github projects which had a lot of errors.

    ReplyDelete