Terminal multiplexer with status line

Recently I started using tmux and powerline again. I needed a way to split terminal windows into panes and monitor cpu, memory and network at the same time. Here I show how to install it.

The screenshot below shows the result. I am using iTerm2, tmux, powerline (cpu, network, memory, battery, weather, date, time, hostname), oh-my-zsh (amuse theme) and vim with plugins

Installation

As a terminal on os x I am using iTerm2 (just unzip and move to the Applications). To install tmux you can use brew. I also highly recommend to use oh-my-zsh shell. Those tools are out of scope for this post, so I focus on tmux and powerline only.

powerline

Run following command to install powerline, powerline plugin for memory and python library for retrieving information on system utilization:

pip install --user powerline-status powerline-mem-segment psutil

Powerline uses several special characters. This requires having a patched font installed in the system. Install the fonts and configure iTerm to use them using:

git clone https://github.com/powerline/fonts
cd fonts
./install.sh

Go to iTerm2 > Preferences > Profiles > Defautl -> Text and then set
Regular Font = 12pt Meslo LG S Regular for Powerline
Non-ASCII Font = 12pt Meslo LG S Regular for Powerline

Next, add those exports to ~/.zshrc

export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8

Now you are ready to configure the status line. The root config directory for powerline is:

~/Library/Python/2.7/lib/python/site-packages/powerline/config_files

Replace themes/tmux/default.json with:

And add this to colorschemes/default.json.

After all run

powerline-daemon --replace

tmux

To install tmux run

brew install tmux

Then create ~/.tmux.conf and set the proper path to powerline.

Usage

Now you are ready to use tmux with powerline!

tmux # launch tmux
tmux ls # list sessions
tmux kill-session -t id # kill session

In tmux use following commands to manage panes:

^+b % # split terminal horizontally
^+b " # split terminal vertically
^+b o # switch pane
^+b x # close pane

For more tmux shortcuts and powerline configuration see links below.

https://powerline.readthedocs.org/en/latest/
https://gist.github.com/MohamedAlaa/2961058

comments powered by Disqus