Powerline, git, Fedora

I recently discovered powerline, thanks to a Fedora news article. Getting powerline running on your Bash terminal is completely trivial and discussed in the article. You just:

Install powerline.

[shell]
sudo dnf install powerline
[/shell]

Configure your shell to use the powerline daemon.

bash

Add this to your .bashrc

[shell] if [ -f `which powerline-daemon` ]; then
powerline-daemon -q
POWERLINE_BASH_CONTINUATION=1
POWERLINE_BASH_SELECT=1
. /usr/share/powerline/bash/powerline.sh
fi
[/shell]

fish

add this to ~/.config/fish/config.fish:

[shell]
set fish_function_path $fish_function_path "/usr/share/powerline/fish"
powerline-setup
[/shell]

Configure powerline to display git information

If all you want to do is get the git branch displayed on your powerline, that’s pretty easy, see for example this excellent article. But after I discovered powerline-gitstatus, I just had to have it.

Install the powerline-gitstatus segment:

[shell]pip install powerline-gitstatus[/shell]

Setup a configuration

I’ve put my powerline configuration up on github, so if you like, you can start with my configuration, and play with it from there simply by clone my powerline-configuration repository into your local .config directory. I.e.:

[shell]
cd ~/.config
git clone https://github.com/spacemoose/powerline_cofiguration.git powerline
[/shell]

Otherwise you can copy over the default configuration and follow the directions here.

Try out your new configuration

Since this article is focused on customizing our shell prompt, we are dealing with the powerline daemon, which means we must run
[shell]
powerline-daemon –replace
[/shell]

when we want to see what effect our changes might have – BUT before you do that, I highly recommend running powerline-lint in case you forgot a comma somewhere.

Leave a Reply

Your email address will not be published. Required fields are marked *