Skip to content

Instantly share code, notes, and snippets.

@leosuncin
Last active October 12, 2023 18:00
Show Gist options
  • Save leosuncin/25bad6ae66c5d513b986 to your computer and use it in GitHub Desktop.
Save leosuncin/25bad6ae66c5d513b986 to your computer and use it in GitHub Desktop.
Install Powerline on Debian/Ubuntu
  1. Install pip sudo apt-get install python-pip or wget https://bootstrap.pypa.io/get-pip.py && sudo python get-pip.py
  2. Install powerline sudo pip install powerline-status
  3. Download and install fonts git clone https://github.com/powerline/fonts.git && cd fonts && sh ./install.sh
  4. Add this lines to respective file
    .vimrc

set rtp+=/usr/local/lib/python2.7/dist-packages/powerline/bindings/vim/
" Always show statusline
set laststatus=2
" Use 256 colours (Use this setting only if your terminal supports 256 colours)
set t_Co=256

.bashrc

if [ -f /usr/local/lib/python2.7/site-packages/powerline/bindings/bash/powerline.sh ]; then
source /usr/local/lib/python2.7/site-packages/powerline/bindings/bash/powerline.sh
fi

.zshrc

if [[ -r /usr/local/lib/python2.7/site-packages/powerline/bindings/zsh/powerline.zsh ]]; then
source /usr/local/lib/python2.7/site-packages/powerline/bindings/zsh/powerline.zsh
fi

.tmux.conf

source /usr/local/lib/python2.7/site-packages/powerline/bindings/tmux/powerline.conf
set-option -g default-terminal "screen-256color"

@AlexZeitler
Copy link

In addition I had to use /usr/local/lib/python2.7/dist-packages/powerline/bindings/shell/powerline.sh and sudo apt-get install powerline on Ubuntu 17.10

@paraita
Copy link

paraita commented Feb 9, 2018

Same as @AlexZeitler I had to use the following command instead:

source /usr/local/lib/python2.7/dist-packages/powerline/bindings/tmux/powerline.conf
set-option -g default-terminal "screen-256color"

I'm running Ubuntu 16.04.03

@preston3271
Copy link

Yes @AlexZeitler the modified path of .../dist-packages/... worked for Ubuntu 17.10. I also used the "wget," method above. Thanks.

@JaDogg
Copy link

JaDogg commented Jun 7, 2018

I had to use following..

wget https://github.com/Lokaltog/powerline/raw/develop/font/PowerlineSymbols.otf https://github.com/Lokaltog/powerline/raw/develop/font/10-powerline-symbols.conf
mkdir -p ~/.fonts/ && mv PowerlineSymbols.otf ~/.fonts/
fc-cache -vf ~/.fonts
mkdir -p ~/.config/fontconfig/conf.d/ && mv 10-powerline-symbols.conf ~/.config/fontconfig/conf.d/

Taken from https://askubuntu.com/questions/283908/how-can-i-install-and-use-powerline-plugin

@vlad88sv
Copy link

Ubuntu 19.04

if [ -f /usr/local/lib/python2.7/dist-packages/powerline/bindings/bash/powerline.sh ]; then
source /usr/local/lib/python2.7/dist-packages/powerline/bindings/bash/powerline.sh
fi

@krisives
Copy link

krisives commented Sep 7, 2019

For anyone curious on 18.04 LTS or derived systems like KDE Neon:

sudo apt install powerline
source /usr/share/powerline/bindings/bash/powerline.sh

For permanent setup add the source command above to your ~/.bashrc file.

@ericlancebrown
Copy link

ericlancebrown commented Dec 28, 2019

I got Bash to finally use Powerline on Debian 10 & Ubuntu 19.04 using this in my ~/.bashrc for user and root:

In your terminal:

nano ~/.bashrc

Add these lines to the bottom:

# Powerline
if [ -f 'which powerline-daemon' ]; then
powerline-daemon -q
POWERLINE_BASH_CONTINUATION=1
POWERLINE_BASH_SELECT=1
fi
if [ -f /usr/local/lib/python2.7/dist-packages/powerline/bindings/bash/powerline.sh ]; then
source /usr/local/lib/python2.7/dist-packages/powerline/bindings/bash/powerline.sh
fi

CTRL + O || CTRL + X

Then, in your terminal again:

source ~/.bashrc

@ibnYusrat
Copy link

For anyone curious on 18.04 LTS or derived systems like KDE Neon:

sudo apt install powerline
source /usr/share/powerline/bindings/bash/powerline.sh

For permanent setup add the source command above to your ~/.bashrc file.

How to you run powerline-status with this method?

@Anogoya-Dagaate
Copy link

Something isn't sitting right - following the steps but my bash prompt still indicates problems rendering some characters indicated by the small question mark icons. And yes I did run powerline.sh to source the file
image

@johnjimysom
Copy link

johnjimysom commented Jun 28, 2021

Something isn't sitting right - following the steps but my bash prompt still indicates problems rendering some characters indicated by the small question mark icons. And yes I did run powerline.sh to source the file
image

You have to set your font by the preferences of Ubuntu 18.04 LTS, right click the window to get to it. You will need to install the fonts first,

https://www.nerdfonts.com/font-downloads for fonts to use. Unzip a font and install it to Windows and then change the font using Ubuntu preferences.

Reason why you are getting question mark boxes because the default Windows font don't have the powerline fonts (because they don't have the fancy symbols), you have to set it to the ones that you downloaded and installed. Restart the app and then it should change. Assuming you are doing WSL Ubuntu. Sample of mines
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment