Skip to content
← 1978.io blog.1978.io

Make tmux tell you its own shortcuts

· 1 min read

I've started running long jobs on a home server: an AI agent that builds code, and a little AI pet that lives there around the clock. They run inside tmux, so they keep going when I close my laptop or my SSH session drops.

tmux is brilliant at that. It is not brilliant at telling you how to use it. Every command starts with Ctrl+b and then a letter you're supposed to just know. Detach is Ctrl+b then d. New window is Ctrl+b then c. And the first time you're left staring at a full-screen program, wondering how to leave without killing it, there's nothing on screen to help.

tmux comes from a world (it dates from 2007, built on GNU screen from 1987) where you learned the keys once and never needed a hint again. Fair enough. But it also has a status bar at the bottom that can show anything you like. So I made it show its own shortcuts.

The hints bar

Paste this into a terminal on the machine that runs tmux:

cat >> ~/.tmux.conf <<'EOF'
set -g status-right "#[fg=colour250] ^b d detach · ^b c new · ^b n/p next/prev · ^b s sessions · ^b , rename  #[fg=colour244]%H:%M "
set -g status-right-length 90
EOF
tmux source-file ~/.tmux.conf

^b is shorthand for Ctrl+b. The bar updates straight away in every open session, and the time stays on the end so you don't lose the clock. Now the five things I actually do (detach, new window, next/previous window, pick a session, rename a window) are written right there, every time I look down.

The rest of my ~/.tmux.conf

set -g default-terminal "tmux-256color"
set -g status-style "bg=colour236,fg=colour250"
set -g mouse on
  • tmux-256color tells programs inside tmux they can use 256 colors.
  • status-style swaps the default bright green bar for a quiet dark grey.
  • mouse on lets the scroll wheel scroll, and lets you click between windows. One catch: tmux now grabs mouse selections, so to copy text the normal way, hold Shift while you drag.

The lime-green mystery

Inside tmux, Claude Code's code diffs came out as a solid, eye-watering lime. Outside tmux they were a soft dark green.

The first fix I tried (it's the one most guides suggest) was telling tmux the outer terminal supports full 24-bit color:

set -as terminal-features ",xterm*:RGB"

It didn't help. So I tested the terminal itself:

printf '\e[48;2;30;70;30m  dark green test  \e[0m\n'

That should print on a dark green background. In my terminal (MobaXterm on Windows) it printed on black: it simply can't show 24-bit color. But with that RGB line in place, tmux was telling every program "full color available", so they sent colors the terminal couldn't draw.

The fix was to delete that line. Without it, tmux translates full colors into the nearest of the 256 the terminal can show, and the soft green came back. Then detach and reattach (tmux only re-checks the terminal when you reconnect), and even the windows that were already running look right.

The lesson I keep relearning: test the thing before you trust the guide. One printf beat an hour of guessing.

Share this post

← All posts