← Back to powerline/powerline

How to Deploy & Use powerline/powerline

Powerline Deployment and Usage Guide

Prerequisites

Powerline requires Python 2.6+ or Python 3.2+ with the following dependencies:

  • Python (2.6+ or 3.2+)
  • pip (for installation)
  • Git (for cloning the repository)

For development, you'll also need:

  • A supported shell (bash, zsh, fish)
  • A supported terminal (tmux, screen, or a modern terminal emulator)
  • For Vim integration: Vim 7.3+ with Python support

Installation

From PyPI (Recommended)

pip install powerline-status

From Source

git clone https://github.com/powerline/powerline.git
cd powerline
python setup.py install --user

For Development

git clone https://github.com/powerline/powerline.git
cd powerline
pip install -r requirements.txt
python setup.py develop --user

Configuration

Configuration Files

Powerline looks for configuration files in the following locations (in order of precedence):

  1. ~/.config/powerline/ (user config)
  2. /etc/xdg/powerline/ (system config)
  3. /usr/share/powerline/ (system config)

Create the config directory if it doesn't exist:

mkdir -p ~/.config/powerline

Shell Integration

Bash:

# Add to ~/.bashrc
powerline-daemon -q
POWERLINE_BASH_CONTINUATION=1
POWERLINE_BASH_SELECT=1
. /usr/local/lib/python3.x/site-packages/powerline/bindings/bash/powerline.sh

Zsh:

# Add to ~/.zshrc
powerline-daemon -q
. /usr/local/lib/python3.x/site-packages/powerline/bindings/zsh/powerline.zsh

Fish:

# Add to ~/.config/fish/config.fish
powerline-daemon -q
. /usr/local/lib/python3.x/site-packages/powerline/bindings/fish/powerline-setup.fish
powerline-setup

Vim Integration

Add to your ~/.vimrc:

set rtp+=/usr/local/lib/python3.x/site-packages/powerline/bindings/vim/
set laststatus=2
set t_Co=256

Tmux Integration

Add to your ~/.tmux.conf:

source "/usr/local/lib/python3.x/site-packages/powerline/bindings/tmux/powerline.conf"

Build & Run

Development Server

To run Powerline in development mode:

# Start the powerline daemon
powerline-daemon -f

# Test the statusline
powerline-render

Testing Configuration

# Check configuration syntax
powerline-lint --config

# Test a specific segment
powerline-render --shell zsh --config-ext vim

Deployment

Powerline is primarily a client-side tool and doesn't require traditional server deployment. However, for distributing configurations across multiple machines:

Package Manager Deployment

Debian/Ubuntu:

sudo apt-get install powerline

Arch Linux:

sudo pacman -S powerline

macOS (Homebrew):

brew install powerline

Configuration Management

For managing configurations across multiple systems, consider using:

  • Git for version control of config files
  • Ansible or similar configuration management tools
  • Symlinks to share common configurations

Troubleshooting

Common Issues

1. Powerline segments not showing up

# Check if powerline-daemon is running
ps aux | grep powerline-daemon

# Restart the daemon
powerline-daemon --replace

2. Unicode characters not displaying correctly

# Check terminal encoding
echo $LANG

# Set to UTF-8 if needed
export LANG=en_US.UTF-8

3. Vim integration not working

# Check if Vim has Python support
vim --version | grep +python

# If not, rebuild Vim with Python support
./configure --enable-pythoninterp

4. Configuration file not found

# Check search paths
powerline-daemon --print-config

# Create missing directories
mkdir -p ~/.config/powerline

Debug Mode

Enable debug logging:

powerline-daemon -f

Check logs:

tail -f ~/.local/share/powerline/powerline.log

Linting Configuration

# Check all configurations
powerline-lint

# Check specific extension
powerline-lint --ext vim

# Check specific file
powerline-lint ~/.config/powerline/themes/vim/default.json