Skip to content

Instantly share code, notes, and snippets.

@trungnt13
Last active February 18, 2026 13:18
Show Gist options
  • Select an option

  • Save trungnt13/34a8b101ab7fe14f7f0f194d1f63ad6c to your computer and use it in GitHub Desktop.

Select an option

Save trungnt13/34a8b101ab7fe14f7f0f194d1f63ad6c to your computer and use it in GitHub Desktop.
tmux_linux.conf
# tmux.conf for macOS (Apple Silicon) — multi-agent coding sessions
# v3 — 17Feb26
#
# ╭─────────────────────── QUICK START ───────────────────────╮
# │ │
# │ INSTALL: │
# │ brew install tmux │
# │ cp tmux_macos.conf ~/.tmux.conf │
# │ tmux source-file ~/.tmux.conf # reload if running │
# │ │
# │ LAUNCH MULTI-AGENT SESSION: │
# │ tmux new -s work # new session │
# │ Prefix = Ctrl-b (or Ctrl-a) │
# │ │
# │ QUICK LAYOUTS (Prefix + key): │
# │ Alt-2 → 2 side-by-side panes (2 agents) │
# │ Alt-3 → 1 main + 2 stacked (3 agents) │
# │ Alt-4 → 2×2 grid (4 agents) │
# │ = → re-tile all panes evenly │
# │ │
# │ NAVIGATE PANES: │
# │ Alt + Arrow → jump between panes (no prefix) │
# │ Shift + Arrow → resize panes (no prefix) │
# │ Alt + 1-9 → jump to window N (no prefix) │
# │ z → zoom/unzoom current pane │
# │ │
# │ SPLIT & MANAGE: │
# │ | or \ → vertical split - or _ → horizontal │
# │ S → sync input to ALL panes (toggle) │
# │ X → kill pane (no confirm) │
# │ r → reload this config │
# │ │
# │ CLAUDE CODE AGENT TEAMS: │
# │ Start claude inside tmux → auto split-pane mode │
# │ teammateMode "tmux" in settings.json for split panes │
# │ Click any pane to interact with that teammate │
# │ │
# ╰───────────────────────────────────────────────────────────╯
# ─── Core ────────────────────────────────────────────────────────────────────
set -g history-limit 250000 # agents produce lots of output
set -g default-terminal "tmux-256color"
set -sa terminal-overrides ",xterm-256color:Tc" # 24-bit color passthrough
set -g escape-time 10 # fast ESC (critical for vim/neovim)
set -g focus-events on # let apps detect focus changes
set -g set-clipboard on # OSC-52 clipboard → macOS pasteboard
set -g mouse on # click panes, scroll, resize
set -g base-index 1 # windows start at 1
set -g pane-base-index 1 # panes start at 1
set -g renumber-windows on # keep window numbers sequential
set -g allow-rename off # keep stable window names
set -g set-titles on
set -g set-titles-string "#S:#I — #W"
set -g aggressive-resize on # resize to smallest *active* client
setw -g main-pane-width 55% # main-vertical: main pane takes 55% of width
setw -g main-pane-height 55% # main-horizontal: main pane takes 55% of height
# ─── Appearance ──────────────────────────────────────────────────────────────
set -g window-style "bg=#0a0a0a"
set -g window-active-style "bg=#000000"
set -g pane-border-style "fg=#333333,bg=default"
set -g pane-active-border-style "fg=#ff6600,bg=default"
set -g pane-border-lines heavy # thicker borders — easy to see splits
# Status bar — hidden (zen mode); toggle with Prefix+B
set -g status off
set -g status-position top
set -g status-interval 5
set -g status-style "bg=#1a1a2e,fg=#e0e0e0"
set -g status-left-length 30
set -g status-right-length 60
set -g status-left "#[fg=#00ff88,bold] #S #[fg=#555555]│ "
set -g status-right "#[fg=#555555]│ #[fg=#88aaff]#{pane_current_command} #[fg=#555555]│ #[fg=#aaaaaa]%H:%M "
setw -g window-status-format "#[fg=#666666] #I:#W "
setw -g window-status-current-format "#[fg=#ff6600,bold] #I:#W#{?window_zoomed_flag, Z,} "
set -g message-style "bg=#1a1a2e,fg=#ff6600,bold"
# ─── Prefix ─────────────────────────────────────────────────────────────────
set -g prefix C-b
set -g prefix2 C-a
bind C-a send-prefix -2
# ─── Pane Splitting (max 4 panes) ────────────────────────────────────────────
bind | if-shell "[ #{window_panes} -lt 4 ]" \
"split-window -h -c '#{pane_current_path}'" \
"display-message 'max 4 panes'"
bind \\ if-shell "[ #{window_panes} -lt 4 ]" \
"split-window -h -c '#{pane_current_path}'" \
"display-message 'max 4 panes'"
bind - if-shell "[ #{window_panes} -lt 4 ]" \
"split-window -v -c '#{pane_current_path}'" \
"display-message 'max 4 panes'"
bind _ if-shell "[ #{window_panes} -lt 4 ]" \
"split-window -v -c '#{pane_current_path}'" \
"display-message 'max 4 panes'"
# ─── Pane Navigation (no prefix needed) ─────────────────────────────────────
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
# ─── Pane Resizing (no prefix needed) ───────────────────────────────────────
bind -n S-Left resize-pane -L 3
bind -n S-Right resize-pane -R 3
bind -n S-Up resize-pane -U 2
bind -n S-Down resize-pane -D 2
# Fine-grained with prefix
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
# ─── Window Navigation (no prefix needed) ───────────────────────────────────
bind -n M-1 select-window -t 1
bind -n M-2 select-window -t 2
bind -n M-3 select-window -t 3
bind -n M-4 select-window -t 4
bind -n M-5 select-window -t 5
bind -n M-6 select-window -t 6
bind -n M-7 select-window -t 7
bind -n M-8 select-window -t 8
bind -n M-9 select-window -t 9
bind c new-window -c "#{pane_current_path}"
# ─── Pane Direct Select (Prefix + 1/2/3/) ────────────────────────────────────
bind 1 select-pane -t 1
bind 2 select-pane -t 2
bind 3 select-pane -t 3
bind 4 select-pane -t 4
# ─── Zoom & Layout ──────────────────────────────────────────────────────────
bind Space next-layout
bind = select-layout tiled # equal grid — best for 3–4 agents
bind + select-layout even-horizontal # side-by-side columns
bind E select-layout even-vertical # stacked rows
# ─── Quick Agent Layouts ────────────────────────────────────────────────────
# Prefix + Alt-2: 2 side-by-side panes
bind 8 \
split-window -h -c "#{pane_current_path}" \;\
select-layout even-horizontal
# Prefix+9: toggle between main-vertical (1 big + 2 stacked) and even-horizontal (3 columns)
# Creates panes first if fewer than 3 exist
bind 9 if-shell "[ #{window_panes} -lt 3 ]" \
"split-window -h -c '#{pane_current_path}' \; split-window -v -c '#{pane_current_path}' \; select-layout main-vertical" \
"if-shell 'echo \"#{window_layout}\" | grep -q ^main-vertical' \
'select-layout even-horizontal' \
'select-layout main-vertical'"
# Prefix + Alt-4: 2×2 grid
bind 0 \
split-window -h -c "#{pane_current_path}" \;\
split-window -v -c "#{pane_current_path}" \;\
select-pane -t 1 \;\
split-window -v -c "#{pane_current_path}" \;\
select-layout tiled
# ─── Sync Input (broadcast to all panes) ────────────────────────────────────
bind S setw synchronize-panes \; \
display-message "sync: #{?synchronize-panes,ON,OFF}"
# ─── Session Management ─────────────────────────────────────────────────────
bind s choose-tree -sZ
bind N command-prompt -p "new session:" "new-session -s '%%'"
# ─── Copy Mode ──────────────────────────────────────────────────────────────
set -g mode-style "bg=#2a2a4a,fg=#e0e0e0"
bind v copy-mode
# macOS clipboard integration (pbcopy)
bind -T copy-mode v send-keys -X begin-selection
bind -T copy-mode y send-keys -X copy-pipe-and-cancel "pbcopy"
bind -T copy-mode Escape send-keys -X cancel
bind -T copy-mode MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "pbcopy"
# Custom IJKL navigation (copy-mode)
bind-key -T copy-mode 'i' send-keys -X cursor-up
bind-key -T copy-mode 'k' send-keys -X cursor-down
bind-key -T copy-mode 'j' send-keys -X cursor-left
bind-key -T copy-mode 'l' send-keys -X cursor-right
bind-key -T copy-mode 'u' send-keys -X start-of-line
bind-key -T copy-mode 'o' send-keys -X end-of-line
bind-key -T copy-mode '.' send-keys -X page-up
bind-key -T copy-mode ',' send-keys -X page-down
bind-key -T copy-mode '[' send-keys -X begin-selection
bind-key -T copy-mode 'Space' send-keys -X begin-selection
bind-key -T copy-mode ']' send-keys -X clear-selection
bind-key -T copy-mode Enter send-keys -X copy-pipe-and-cancel "pbcopy"
# Scroll into copy mode with mouse wheel
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" \
"if -Ft= '#{pane_in_mode}' 'send-keys -M' 'copy-mode -e'"
# ─── Utility ────────────────────────────────────────────────────────────────
bind r source-file ~/.tmux.conf \; display-message "config reloaded"
bind X kill-pane
bind Q confirm-before -p "kill window #W? (y/n)" kill-window
bind m select-pane -m
bind M swap-pane
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment