Red Green Repeat Adventures of a Spec Driven Junkie

Minimum Viable tmux

I’m going through and my configuration files: emacs, vim, and now I will cover tmux - the terminal multiplexer.


Revisiting configuration files has been refreshing. I have removed old cruft that has built up over the years and also made me re-think what is necessary for me to be productive with a minimal setup.

Using tmux has benefits, even on a local machine. Switching between different “tabs” with a keyboard, splitting windows, and reconnecting to previous sessions are features I use frequently.

Also, from the Pragmattic Programmer’s tmux page:


“Don’t be Jimmy” :-)


The intended audience is for anyone that uses tmux daily to enhance their configuration.

If you are looking to learn or just started using tmux, this book is better suited for those purposes.


I have used tmux 1.8 and generally prefer 2.0 or higher. The minimal configuration described in this article will work with tmux 1.8 or higher. Tmux 2.0 has better color options if one wishes to enhance their configuration further.

GNU screen vs. tmux

Just a quick aside: I used to be a big user of gnu screen, the original terminal multiplexer.

I could never configure screen the way I liked, so on every new system, I would goto a page on RedHat magazine to use this configuration:

hardstatus alwayslastline
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{=kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B}%Y-%m-%d %{W}%c %{g}]'

# Default screens
screen -t shell1 0
screen -t shell2 1
screen -t server 2 ssh me@myserver

Honestly, it looked great, but for the life of me, I could not make any changes to it. Like if I wanted different colors… or move something around, I was just lost.

That’s the problem with copy & pasting configurations found online!

As my desire for more configurations increased, I eventually found tmux and never looked back. I love gnu screen’s minimalism, but not TTY codes!

Honestly, I couldn’t find the original article, thanks to my github gist for preserving the .screenrc!

Where to Find

The full .tmux.conf described in this article is at:


Some quick terminology:

prefix key Pressing this key combination sends tmux specific commands. By default, it is control-b
session Every time tmux starts, it creates a new session. Multiple sessions are usable
window A single window inside a session.
pane A segment inside a window.

Prefix Key

As I started out using gnu screen before tmux, I have a lot of muscle memory using ctrl-a as my prefix key and other movements.

set -g prefix C-a    # remap prefix to Control + a --> I miss gnu screen. :-)
bind a send-prefix # send 'C-a' into terminal app by typing: 'C-a a'
bind C-a last-window # bounce between windows just by typing 'C-a C-a'
unbind C-b # get rid of C-b as prefix. Helps emacs to work better.
set -g prefix C-a makes the prefix key to be control-a
bind a send-prefix tells tmux to send control-a to the application when pressing: control-a a
bind C-a last-window tells tmux to goto the last window when pressing: control-a control-a (just like what gnu screen does)
unbind C-b tells tmux to release capturing control-b as its prefix

The last one may not be necessary, but I found it necessary within emacs, as control-b is an essential navigation key: move back!

Status Bar

Oooh, the status bar. The main reason why I switched from gnu screen to tmux!

Having a good looking status bar is essential when working with multiple windows and sessions! As tmux is so bare, having a little information can help navigation.


I like having the background of the bottom line to be blue with white text, just so it stands out better on a black background, with the active window with bold green text.

# Set status bar
set -g status-bg blue
set -g status-fg white
set -g window-status-current-style fg=green,bold # highlight currently active window in status bar with different color


Improve tmux’s compatibility with apps like htop by having tmux define the terminal type to be screen.

set -g default-terminal "screen"                  # make applications compatible

Status Info

On the left side, I like to have nothing, so I can have more windows displayed on the bottom.

On the right side, I recently started using sessions, so to keep track of which session I am in, the session name is on the status line with: { session: x } around it.

The status length by default is only ten characters, so I can have descriptive session names.

set -g status-left ""
set -g status-right "{ session: #S }"
set -g status-right-length 255

Key Mode

I might have started with vim but I prefer emacs keys now, so I set tmux to use emacs keys instead:

set -g status-keys emacs
setw -g mode-keys emacs


As I have started doing with my .vimrc, keeping additional key combination notes in the configuration file helps me from looking up basic stuff over and over.

I have found tmux to be a bit harder to look up each time, especially copy/paste.

Session Switching

To encourage more use of sessions (instead of tabs in the terminal), I wrote down how to switch sessions and rename sessions.

# prefix + {(,)}  - switch between sessions
# prefix + $ - rename current session

Window Management

I like to have lots of windows in a session, but when all of the titles are just bash, their usefulness quickly diminish. Renaming windows and moving windows to better positions help manage multiple windows.

# prefix + ,      - rename window
# prefix + . - move window to number

Copy & Paste

I never really had to copy & paste between windows until I wrote integration tests for aruba. Copy and pasting within tmux windows is awesome! Think of it as yet ANOTHER copy/paste buffer!

# copy/pasting
# prefix + [ - freeze window to navigate
# {M-w, enter} - copy highlighted region (emacs style | vim style)
# prefix + ] - paste copied items


That’s the most basic .tmux.conf file I need to feel productive using tmux. I try to keep things to the absolute minimum in configuration, so I can even be productive without these settings.