Home

Awesome

Powerline style prompt for Zsh

This is a fork from https://github.com/milkbikis/powerline-bash

A Powerline like prompt for Zsh:

Powerline-Zsh Screenshot Powerline-Zsh Screenshot2

Setup

If you still face problems seeing colors then read this: https://gist.github.com/3749830#file_powerline_zsh_instructions.md

If you don't want the symlink, just modify the path in the .zshrc command below

function _update_ps1()
{
    export PROMPT="$(~/powerline-zsh.py $?)"
}
precmd()
{
    _update_ps1
}
-h, --help  show this help message and exit
--cwd-only  Hide parent directory
--hostname  Show hostname at the begin
-m <mode>   Choose icon font: default, compatible, patched or konsole.
            Default is "default"

Python version note

Most of the distros use Python2 as default, however, Some distros like Archlinux use Python3. The earlier version of powerline-zsh is not compatible with Python3. With such condition, you have two ways to solve this issue.

  1. Use the newest version of powerline-zsh. Just download from the master branch.
  2. Modify the .zshrc content, use python2 to execute it.
function _update_ps1()
{
    export PROMPT="$(python2 ~/powerline-zsh.py $?)"
}
precmd()
{
    _update_ps1
}

Pypy note

You can use pypy to speed up your script execution, in your .zshrc:

function _update_ps1()
{
    error=$?
    if [[ -s "/usr/local/bin/pypy" ]]; then
        export PROMPT="$(pypy ~/powerline-zsh.py $error)"
    else
        export PROMPT="$(~/powerline-zsh.py $error)"
    fi
}
precmd()
{
    _update_ps1
}

konsole user note

You may not see the icons when using konsole. To solve this problem, you can use -m option:

function _update_ps1()
{
    export PROMPT="$(~/powerline-zsh.py -m konsole $?)"
}
precmd()
{
    _update_ps1
}

Authors and License

The powerline-zsh package is written by Chien-Wei Huang, Shrey Banga and contributors. It’s MIT licensed and freely available.

Feel free to improve this package and send a pull request to GitHub.