Powerline Shell



About

Awesome prompt for exposing git branch/commit status and other details...

Powerline Fonts

This is the same for any installation. It installs a great set of fonts for powerline into ~/.local/share/fonts.

Downloads
git clone https://github.com/powerline/fonts powerline-fonts
cd powerline-fonts
./install.sh

Finally:

  • Relogin to pick up the new powerline fonts
  • Open up your terminal's settings and choose one of the powerline fonts (konsole->settings->manage profiles->edit 'Shell' profile->appearance).
    • Dejavu Sans Mono is a good choice for konsole.


The powerline-fonts deb package in ubuntu does not install all of the fonts in the git repo - just enough to support default usage of the powerline deb package.

MacOs 12

  • Install powerline-fonts (see above)
  • Install powerline-shell
  • Setup a default command line prompt as instructed in the README (works for me)

Ubuntu Xenial


Downloads
sudo apt-get install fonts-powerline powerline python-powerline-gitstatus

The latter is from my Append the following to your ~/.bashrc:

~/.bashrc
if [ -f /usr/share/powerline/bindings/bash/powerline.sh ]; then
 source /usr/share/powerline/bindings/bash/powerline.sh
fi

You'll also need to get some tweaking happening to ensure vcs status' show up properly.

Configuration Files
mkdir -p ~/.config/powerline/themes/shell
# copy across the config file so you can override some options
cp /usr/share/powerline/config_files/config.json ~/.config/powerline
# copy across the default_leftonly theme to create your own segment chain
cp /usr/share/powerline/config_files/themes/shell/default_leftonly.json ~/.config/powerline/themes/shell/mine.json

Edit config.json to point to your own theme, mine.json in this case.

~/.config/powerline/config.json
"shell": {
			"colorscheme": "default",
			"theme": "mine",
			"local_themes": {
				"continuation": "continuation",
				"select": "select"
			}
		},

And make sure you parameterise the vcs segment options to show status_colors (only works on linux, so the default is false).

~/.config/powerline/themes/shell/mine.json
{
	"function": "powerline.segments.common.vcs.branch",
	"priority": 40,
	"args": {
	    "status_colors": true
	}
},

The new powerline system has a generic 'vcs' segment and it is very slow if you use colours. Should try the gitstatus segment or fallback to milkibis' powerline-shell like I used on trusty.

Gitstatus is the bomb!

Ubuntu Trusty


Downloads
git clone https://github.com/milkbikis/powerline-shell
cd powerline-shell
cp config.py.dist config.py
./install.py

Append the following to your ~/.bashrc:

~/.bashrc
POWERSHELL_COMMAND=~/tmp/powerline-shell/powerline-shell.py
POWERSHELL_OPTIONS="--cwd-mode=fancy --cwd-max-depth=4 --cwd-max-dir-size=40 --mode=patched --shell=bash"
function _update_ps1() {
    PS1="$(${POWERSHELL_COMMAND} ${POWERSHELL_OPTIONS} $? 2> /dev/null)"
}
if [ "$TERM" != "linux" ]; then
    PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND"
fi

Troubleshooting