Configuring powerline for bash, vim, and tmux
My home machine is a Debian system with an Intel Core i5 processor and 8GB of
RAM. I run an XFCE desktop on it, with the XFCE Terminal hosting a tmux session
I call éowyn
. My shell is plain-old bash, and I use vim as my $EDITOR. Here
are the steps that I ran to configure
powerline in it.
Installation
Instead of tinkering with pip
, we can take advantage of powerline
already
being packaged for Debian:
sudo apt install powerline
That's it! Really simple, and we avoid having to modify our $PATH
in order
to make powerline-daemon
and powerline-config
available.
Configuration
Now we can configure the three main applications that will use powerline: vim, bash, and tmux.
vim
The first thing is making sure that vim
was built with Python support. Since
this is the default Debian vim package, we should see something like this:
$ vim --version | grep +python
+conceal +linebreak +python3 +visualextra
Now, we add the following lines to .vimrc
:
" Powerline configuration
python3 from powerline.vim import setup as powerline_setup
python3 powerline_setup()
python3 del powerline_setup
set laststatus=2
The last line makes sure that the powerline is present even with just one Vim window open.
bash
Add the following lines to .bashrc
:
# Powerline prompt
powerline-daemon -q
POWERLINE_BASH_CONTINUATION=1
POWERLINE_BASH_SELECT=1
source /usr/share/powerline/bindings/bash/powerline.sh
tmux
Add the following lines to .tmux.conf
:
# Set powerline
run-shell 'powerline-config tmux setup'
That's all that is needed to have a beautiful and consistent theme. I did not try to modify it or use another theme, because the out-of-the-box one already matches my XFCE colors pretty closely. Also, please note that I already have the FiraCode Nerd Font installed in this system.
An alternative
My work machine is a MacBook Pro. I tried to set up a beautiful terminal using iTerm2 and powerline, but I wasn't able to do it. I tried following the official instructions:
pip3 install --user powerline-status
# Add the directory inside ~/Library where powerline-daemon lives to $PATH
But I quicly ran into several issues. So, instead, this is what I have in my work machine (which, by the way, would also work fine in a Debian system):
- starship with a modified version of the Pastel Powerline preset.
- vim-airline with the minimalist theme.
- tmux-themepack with a modified
version of the
powerline/double/green
theme.
So is three packages instead of one, but the configuration is easy, too.