blog
Developer GuideAugust 1, 2026

Tmux Config: tmux.conf for Faster AI Coding

A productivity tmux.conf for AI coding: remap the prefix, enable mouse and vi keys, build a status bar, and add one-key layouts for parallel agents.

Independent article: published by AI Coding Tools, not official vendor documentation.

AI Coding Tools Editorial Team|9 min read

Tmux Config: tmux.conf for Faster AI Coding

Out of the box, tmux works — but the defaults (stiff prefix, no mouse, awkward scrolling) get in the way of a smooth AI coding workflow. A small ~/.tmux.conf fixes that. This guide walks through a production config, line by line, and ends with a complete file you can paste.

Where the config lives

Tmux reads ~/.tmux.conf when a server starts. After editing, reload without restarting:

tmux source-file ~/.tmux.conf

Or from inside tmux: Ctrl-b :source-file ~/.tmux.conf.

1. Remap the prefix

The default prefix Ctrl-b is awkward and collides with editor bindings. Ctrl-a (like GNU Screen) or Ctrl-Space are popular. Also rebind the send-prefix key so Ctrl-a still works when you're in a program that uses it:

# ~/.tmux.conf
set -g prefix C-a
bind C-a send-prefix
unbind C-b

2. Mouse, keys, and scrolling

set -g mouse on                # click panes, scroll, select
setw -g mode-keys vi           # vi keys in copy mode
set -g history-limit 100000    # deep scrollback for long agent output
set -g escape-time 10          # snappier key response

escape-time 10 matters more than it looks: it makes pane-switching feel instant, which matters when you're bouncing between parallel agent panes.

3. One-key layout bindings

Create and apply layouts without typing split commands every time:

# Alt-q → four-pane quad grid
bind -n M-q send-keys tmux new-session -d \; split-window -h \; split-window -v -t 0 \; split-window -v -t 2 \; select-pane -t 0

# Alt-1 / Alt-2 → two-pane vertical / horizontal
bind -n M-1 send-keys tmux new-session -d \; split-window -h \; select-pane -t 0
bind -n M-2 send-keys tmux new-session -d \; split-window -v \; select-pane -t 0

# Reload config without leaving the session
bind R source-file ~/.tmux.conf

Press Alt-q and the screen becomes the 2×2 grid for 4 agents in one keystroke.

4. Status bar that shows your work

The default status bar is barely informative. Make it show the session, window, and running panes:

set -g status-bg black
set -g status-fg white
set -g status-interval 5
set -g status-left '#[fg=cyan]Session: #S #[default]|'
set -g status-right '#[fg=green]#(tmux ls | wc -l | tr -d " ") sessions #[default]| %a %b %d %H:%M'
setw -g window-status-current-format '#[fg=black,bg=cyan] #I:#W #[default]'
setw -g window-status-format '#[fg=white] #I:#W #[default]'

With named sessions (tmux new -s api-feature), the left status tells you exactly which agent session you're in — the naming convention from our Claude Code multi-session guide.

5. A complete config file

Paste this into ~/.tmux.conf and reload:

# ── tmux.conf for AI coding ──────────────────────────────
set -g prefix C-a
bind C-a send-prefix
unbind C-b

set -g mouse on
setw -g mode-keys vi
set -g history-limit 100000
set -g escape-time 10

set -g base-index 1
setw -g pane-base-index 1
set -g renumber-windows on

bind -n M-q send-keys tmux new-session -d \; split-window -h \; split-window -v -t 0 \; split-window -v -t 2 \; select-pane -t 0
bind -n M-1 send-keys tmux new-session -d \; split-window -h \; select-pane -t 0
bind -n M-2 send-keys tmux new-session -d \; split-window -v \; select-pane -t 0
bind R source-file ~/.tmux.conf

set -g status-bg black
set -g status-fg white
set -g status-interval 5
set -g status-left '#[fg=cyan]Session: #S #[default]|'
set -g status-right '#[fg=green]#(tmux ls | wc -l | tr -d " ") sessions #[default]| %a %b %d %H:%M'
setw -g window-status-current-format '#[fg=black,bg=cyan] #I:#W #[default]'
setw -g window-status-format '#[fg=white] #I:#W #[default]'

set -g default-terminal "screen-256color"
set -ga terminal-overrides ",xterm-256color:RGB"

Notes on the last two lines: default-terminal keeps colors correct inside agent UIs, and the RGB override enables truecolor where supported — important for Claude Code and other terminal AI tools that use rich color output.

6. Going further with plugins

Install the TPM plugin manager for extensions:

# ~/.tmux.conf (TPM section)
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
run '~/.tmux/plugins/tpm/tpm'
  • tmux-resurrect — restore sessions, windows, and pane commands after a reboot
  • tmux-continuum — save automatically and restore on startup

These two turn tmux into a "never lose your agent sessions" setup, which pairs perfectly with running agents in the background.

FAQ

Where should I put the config on macOS vs Linux?

Same place: ~/.tmux.conf on both. macOS users sometimes add set -g default-shell /bin/zsh to match their login shell.

My colors look wrong in the status bar

Check default-terminal and the truecolor override from section 5. Some SSH connections need -t to allocate a TTY before tmux starts.

Can I have multiple configs for different projects?

Yes — run tmux -f ~/.tmux.project.conf new -s <project> for project-specific layouts, or use a binding that sources a second file. The four-pane guide shows how layout bindings scale per project.

Next steps

Share this article