Image for post
Image for post
Use Powerline to make your git repository visible.

TLDR

Image for post
Image for post
Comparison with and without Powerline: How to check git status with branch information.

Git and Bash

Powerline for Bash

Image for post
Image for post
Comparison with and without Powerline: Unveil hidden repository information.

Although Powerline is written in Python and can be easily installed with pip, many documentations describing the configuration of Powerline aren’t straight forward leaving quite some users with the frustrating reality of having an only partially working solution. Since I was one of those frustrated users, I want to try explaining the process of getting Powerline to work in a more complete way for Ubuntu and macOS.

Installation and configuration

Ubuntu

Since Powerline is provided via pip, the first step is to install pip3 if we do not already have it on our system.

Install pip3:

Install Powerline:

Start powerline by adding it to ~/.bashrc file:

Logout and log back in.

With this configuration, when starting a new terminal we will already see Powerline popping up. Unfortunately, this does not yet show any git related information when changing your location into a git repository. To make Powerline working with git as described, there is something more we need to do.

Installing Powerline Gitstatus:

Open the following file and add the lines after the “attached_clients” entry:

~/.local/lib/python3.8/site-packages/powerline/config_files/colorschemes/default.json

Open the following file and change the lines:

~/.local/lib/python3.8/site-packages/powerline/config_files/themes/shell/default.json

Change line from:

To:

Finally, we need to install the Powerline font enabling our shell to show all the special characters and icons correctly.

Go to your Download directory and clone the Powerline font git repository and install the fonts:

To use the newly installed fonts in the terminal open preferences and open the selected profile. Check “custom font” and change the font to “Source Code Pro for Powerline Regular”.

Since we have updated the files in the main directory, we can copy the configurations to the user’s home to ensure that the configuration persists even when update change things in the background.

To do so generate the directory structure in the user’s home:

And copy the configuration files:

macOS

Since Powerline is provided via pip, the first step is to install pip3 if we do not already have it on our system.

The easiest way to install an up to date pip3 is by using Homebrew (https://brew.sh):

Once pip3 is installed, we can use it to install Powerline:

Start powerline by adding it to ~/.bash_profile file:

Logout and log back in.

With this configuration, when starting a new terminal we will already see Powerline popping up. Unfortunately, this does not yet show any git related information when changing your location into a git repository. To make Powerline work with git as described, there is something more we need to do.

Installing Powerline Gitstatus:

Open the following file and add the lines after the “attached_clients” entry:

/usr/local/lib/python3.8/site-packages/powerline/config_files/colorschemes/default.json

Open the following file and change the lines:

/usr/local/lib/python3.8/site-packages/powerline/config_files/themes/shell/default.json

Change line from:

To:

Finally, we need to install the Powerline font enabling our shell to show all the special characters and icons correctly.

Go to your Download directory and clone the Powerline font git repository and install the fonts:

To use the newly installed fonts in terminal, open preferences (click “Terminal” in the top bar, then Preferences) and open the selected profile. Change the font to “Source Code Pro for Powerline Regular”.

Since we have updated the files in the main directory, we can copy the configurations to the user’s home to ensure that the configuration persists even when update change things in the background.

To do so generate the directory structure in the user’s home:

And copy the configuration files:

Visual Studio Code

Terminal Integrated Font Family → Source Code Pro for Powerline

The more detailed way on doing so is described here:

Alternative to Powerline

About the Author

Earlybyte is an IT consultancy firm specialized in developing new digital solutions for companies around the world from digitalization to IoT solutions, close to the client and its business embracing agility.

Powerline Repositories

Credits

Written by

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store