How I use TMUX
How I use TMUX
Part of the [[10 minute devops]] series
I use tmux because I want a repeatable terminal workflow that I can control from the keyboard.
Not a clever dashboard. Not a wall of panes. Just a small, predictable workspace that I can use every day without thinking about it. The base of all this is usually a full- or half-screen terminal running shells in tmux.
My usual layout is:
- a shell window for running commands, tests,
terraform,ansible, and whatever else the project needs - a Neovim window for editing
- a Pi window when I want a coding agent involved
I don't always need all three, and the order is not strict, but it's familiar enough that I don't have to make a decision every time I start work.
Sessions, windows, and panes
Tmux has three main concepts:
| Term | How I think about it |
|---|---|
| Session | The overall workspace. |
| Window | A tab inside the session. |
| Pane | A split inside a window. |
I mostly use one pane per window. I've tried more elaborate layouts, but for day-to-day work I prefer one main thing in front of me at a time.
I do use panes occasionally. A vertical split is useful if I want to run tests while coding, or watch some output while doing something else. But it is usually temporary. Once the task is done, I go back to separate windows.
Starting tmux
I used to start tmux automatically from zsh but I stopped doing that.
It sounds convenient, but it adds friction when other tools need to open shells or run commands. That matters more now that I use coding agents. Typing tmux at the start of the day is a small price to pay for keeping the rest of the setup simple. And if typing tmux is more than you want you can always make an alias t='tmux'.
The recurring theme in my terminal setup is to remove friction, but not by adding more machinery than the problem deserves.
The keybindings I actually use
My prefix is Ctrl-a, mostly because I was a long-term GNU Screen user and already had the muscle memory. I am not saying everyone should change the tmux prefix. The important thing is to make the workflow comfortable enough that you actually use it.
| Key | What I use it for |
|---|---|
Ctrl-a c | Create a new window |
Ctrl-a n | Go to the next window |
Ctrl-a p | Go to the previous window |
Ctrl-a a | Toggle to the last used window |
Ctrl-a | | Split the current window vertically |
Ctrl-a - | Split the current window horizontally |
Ctrl-a r | Reload the tmux config |
I also start windows and panes at 1 rather than 0, which makes the numbering feel more logical to me because it matches the keyboard layout.
The core of my config looks like this:
set -g prefix C-a
unbind C-b
bind-key C-a send-prefix
set -g base-index 1
setw -g pane-base-index 1
unbind %
bind | split-window -h
unbind '"'
bind - split-window -v
bind-key C-a last-window
bind-key a last-window
Making tmux and Neovim feel like one workspace
One plugin I do find very useful is vim-tmux-navigator.
If I have tmux panes and Neovim splits open at the same time, I don't want to think about whether I am inside tmux or inside Neovim. I want the same movement keys to work across both.
That means Ctrl-h, Ctrl-j, Ctrl-k, and Ctrl-l can become one bit of muscle memory for moving around the workspace.
Copy mode
I use vi-style copy mode so selecting text feels familiar:
set-window-option -g mode-keys vi
bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi 'y' send -X copy-selection
This is another small thing, but small things add up when they are part of the workflow all day.
Status bar
My status bar is mostly boring on purpose. I want to know what window I am in, the time and date, and, on laptops, the battery status.
The battery part is controlled by chezmoi. On machines where battery status is useful, the tmux config includes it. On machines where it is not, it does not.
That gives me a consistent workflow without pretending every machine is exactly the same.
The point
The point of tmux, for me, is not to build an impressive terminal dashboard.
It is to remove tiny bits of friction from work I do every day: a shell, an editor, and sometimes Pi, all reachable with predictable keyboard shortcuts.
That is enough.