Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Powerline is a plug-in to display informational and beautiful statusline for vim, tmux and shell prompt for bash, zsh.

Vim statusline: enter image description here enter image description here enter image description here enter image description here How can I install and setup Powerline for different applications and shells in Ubuntu?

share|improve this question
    
Just as a note. My plugin was installed to dist-packages instead of site-packages so I had to point the applications to that directory instead. It seems to be a convention for debian-based distributions to be able to have more than one python installation configured. Anyways it took me a while to figure this out so I hope this can save you guys some headaches. –  Bax Oct 3 '13 at 6:38

2 Answers 2

up vote 85 down vote accepted

Plugin Installation:

Install python-pip and git: Open terminal by hitting Ctrl+Alt+T and run:

sudo apt-get install python-pip git
  • Per user:
    In terminal run:

    pip install --user git+git://github.com/Lokaltog/powerline
    

    Add ~/.local/bin to $PATH by modifying ~/.profile with your favourite editor:

    gksudo gedit ~/.profile
    

    and adding following lines at the end of it:

    if [ -d "$HOME/.local/bin" ]; then
        PATH="$HOME/.local/bin:$PATH"
    fi
    
  • System wide:
    In terminal run:

    su -c 'pip install git+git://github.com/Lokaltog/powerline'
    

Font Installation:

Powerline provides two ways of installing the required fonts. If you're using one of following terminal: Gnome Terminal, Konsole, lxterminal, st, Xfce Terminal, Terminator, Guake, Yakuake then you should use "Fontconfig" method.

  • Fontconfig: (recommended)

    • Per User:
      Run the following commands in terminal:

      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/
      
    • System wide:
      Run the following commands in terminal:

      wget https://github.com/Lokaltog/powerline/raw/develop/font/PowerlineSymbols.otf https://github.com/Lokaltog/powerline/raw/develop/font/10-powerline-symbols.conf
      sudo mv PowerlineSymbols.otf /usr/share/fonts/
      sudo fc-cache -vf
      sudo mv 10-powerline-symbols.conf /etc/fonts/conf.d/
      
  • Patched font:
    Use this method only if "Fontconfig" method doesn't work for you or you're using a terminal other than mentioned above.

    1. Download the font of your choice from powerline-fonts.
    2. Move your patched font to ~/.fonts/ for per user installation or /usr/share/fonts for system wide installation.
    3. Run fc-cache -vf ~/.fonts to update your font cache, sudo fc-cache -vf to do it system wide.

To use patched font in Gvim see this answer and to change the font of your respective terminal check this question: How to change the font of various terminal emulators?. You may have to reboot your system after font installation for changes to take effect.

Usage: (for per user installation)

  • Vim statusline:
    Add following to your ~/.vimrc or /etc/vim/vimrc:

    set rtp+=$HOME/.local/lib/python2.7/site-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
    
  • Bash prompt:
    Add the following line to your ~/.bashrc or /etc/bash.bashrc:

    if [ -f ~/.local/lib/python2.7/site-packages/powerline/bindings/bash/powerline.sh ]; then
        source ~/.local/lib/python2.7/site-packages/powerline/bindings/bash/powerline.sh
    fi
    
  • Zsh prompt:
    Add the following line to your ~/.zshrc or /etc/zsh/zshrc:

    if [[ -r ~/.local/lib/python2.7/site-packages/powerline/bindings/zsh/powerline.zsh ]]; then
        source ~/.local/lib/python2.7/site-packages/powerline/bindings/zsh/powerline.zsh
    fi
    
  • Tmux statusline:
    Add the following line to your ~/.tmux.conf:

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

    If your terminal supports 256 colours, set TERM environment variable to xterm-256color by modifying ~/.bashrc or /etc/bash.bashrc and adding following line:

    export TERM=xterm-256color
    

    To check if your terminal supports 256 colours check the documentation of your terminal or google it. Most popular terminals support 256 colours.

Usage: (for system wide installation)

  • Vim statusline:
    Add following to your ~/.vimrc or /etc/vim/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
    
  • Bash prompt:
    Add the following line to your ~/.bashrc or /etc/bash.bashrc:

    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
    
  • Zsh prompt:
    Add the following line to your ~/.zshrc or /etc/zsh/zshrc:

    if [[ -r /usr/local/lib/python2.7/dist-packages/powerline/bindings/zsh/powerline.zsh ]]; then
        source /usr/local/lib/python2.7/dist-packages/powerline/bindings/zsh/powerline.zsh
    fi
    
  • Tmux statusline:
    Add the following line to your ~/.tmux.conf:

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

    If your terminal supports 256 colours, Set TERM environment variable to xterm-256color by modifying ~/.bashrc or /etc/bash.bashrc and adding following line:

    export TERM=xterm-256color
    

    To check if your terminal supports 256 colours check the documentation of your terminal or google it. Most popular terminals support 256 colours.

Configuration:

For detailed information on configuring Powerline: Configuration.

Uninstall:

To uninstall Powerline run one of following commands in terminal:

  • To uninstall per user installation:

    pip uninstall powerline
    
  • To uninstall system wide installation:

    su -c 'pip uninstall powerline'
    

Source: Powerline beta documentation

Alternatives:

If you're installing Powerline just for Vim you should try vim-airline which is more customizable and lightweight.

share|improve this answer
1  
It should probably also be mentioned that the user will need to set their emulator to "login" so that ~/.profile will be properly ran or they might run into issues with not being able to use their terminal when it's unable to find the powerline command. –  Jordon Bedwell May 25 '13 at 2:36
    
Basharat Sial's answer is very good; however, when trying to have vim point to the package in the python library for the system wide install, the path that worked for me was: /usr/local/lib/python2.7/dist-packages/powerline/bindings/vim/ Basically just replace the site-packages with dist-packages wherever it appears for the "Usage" steps. Hope this helps anyone who runs into the same thing. –  DaPillow Nov 4 '13 at 0:53
    
as pointed below, the installation path for system wide is /usr/local/lib/python2.7/dist-packages/powerline/. So at the vimrc you should point at /usr/local/lib/python2.7/dist-packages/powerline/bindings/vim/ instead –  demil133 Nov 14 '13 at 17:31
1  
@demil133 Fixed! –  Basharat Sialvi Nov 14 '13 at 18:20
1  
for me (on Ubuntu 12.04) per user font installation doesn't work I had to install fonts system wide –  user2041318 Dec 7 '13 at 8:38

As of Ubuntu 14.10 (utopic), a powerline package is available in the universe repository. To install it, just run this command in your terminal :

sudo apt-get install powerline

Alternatively, you should be able to install it by using the Ubuntu Software Center.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.