.tmux.conf for fun and profit

April 12, 2020

what is this post about

Depending on the day, or the season, I either find myself an ally to the idea that every single thing on my system needs to be custom configured, or I use the default configuration of a tool for seven years in a row not once changing a single thing.

Today I’m looking at my .tmux.conf which is an artifact of somewhere in between of those states. I want to share a few things that made me happy and productive with it. The file is 28 lines long, but a third of it are comments. Conservative.


unbind C-b
set-option -g prefix C-f
bing-key C-f send-prefix

First of all, C-b feels to my hands like a violation of the home row, and thus I move b to f. I never could press it without moving my hand.

bind r source-file ~/tmux.conf \; display "~/.tmux.conf sourced"

If you play with the config a lot, you want the above. Reloads the config for ya.

set -g base-index 1
set -g pane-base-index 1

Zero indexing is fine in programming languages. When I am switching windows and panes it feels sacrimonious to be pressing 0 for first window, but 1 for the second.

bind k split-window -v
bind K split-window -h
unbind %
unbind \"

I like vim keybindings. My fingers are always on j and k. And so I use k and Kfor window splits.

set -g default-terminal "screen-256color"
set -g status-bg black
set -g status-fg white

The green was jarring. Black and white suits me.

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-and-cancel

No config of a tool is complete without some vi remaps, including a few copying tricks. I found that between various emulators (iterm, default macos terminal, integrated vsc terminal) those settings fall apart, and I haven’t been annoyed enough yet to fix this.

Moving around panes

You may notice lack of mappings for moving between panes / splits. I use arrow keys, apart from the fact that I don’t - it’s more intricate and a lot of the smoothness of motion around tmux I benefit from comes from my os-wide keyboard remaps using karabiner. But that’s a topic for another post.

Written by Daniel Kaczmarczyk, a software engineer and educator. you can find me on twitter or email me at daniel.kacz@protonmail.com

a pale blue and yellow circle