Skip to content

Instantly share code, notes, and snippets.

@grantvanhorn
Last active July 28, 2026 20:02
Show Gist options
  • Select an option

  • Save grantvanhorn/e883ed4e6f00a7ddf1148c250e358ec7 to your computer and use it in GitHub Desktop.

Select an option

Save grantvanhorn/e883ed4e6f00a7ddf1148c250e358ec7 to your computer and use it in GitHub Desktop.
[macOS] tmux config (rounded pill status bar w/ sysctl+top metrics, TPM/resurrect/continuum) — ~/.config/tmux/tmux.conf
# =============================================================================
# tmux configuration — macOS
# =============================================================================
# REQUIREMENTS (install with Homebrew — https://brew.sh):
# brew install tmux git
# brew install --cask font-roboto-mono-nerd-font # or any Nerd Font
# - tmux 3.5+ (Homebrew's is current) — needed for extended-keys + status-format.
# - A Nerd Font in your TERMINAL — REQUIRED for the status-bar glyphs (rounded
# pill separators + the CPU/RAM icons). tmux just draws whatever glyphs the
# terminal font provides, so set your terminal (e.g. Ghostty) to a Nerd Font.
# - The status-right uses macOS built-ins (`sysctl -n vm.loadavg` and `top`);
# this file is macOS-specific and will NOT work as-is on Linux.
# - TPM + these plugins (installed by the steps below):
# tmux-plugins/tpm, tmux-resurrect, tmux-continuum
# =============================================================================
# INSTALL (no stow — this goes at the XDG tmux config path):
#
# Destination: ~/.config/tmux/tmux.conf
#
# mkdir -p ~/.config/tmux
# # download the raw file from this gist, or paste its contents into:
# # ~/.config/tmux/tmux.conf
#
# # Then install TPM (the plugin manager) and the plugins:
# git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
# tmux source ~/.config/tmux/tmux.conf # (or start a new tmux)
# # inside tmux, press: Ctrl+b then I to install plugins
#
# Colors below are hard-coded (orange #ff7f41 / dark #0e091d) — tweak to taste.
# =============================================================================
# Start window and pane numbering at 1
set -g base-index 1
set -g pane-base-index 1
# Extended keys: let modified keys (Shift/Ctrl+Enter) reach TUI apps like the pi
# coding agent. Without this, tmux collapses them to plain Enter. Needs tmux 3.5+
# and an extended-keys-capable terminal (Ghostty qualifies).
set -g extended-keys on
set -g extended-keys-format csi-u
# Use Shift + Arrow keys to switch windows without prefix (macOS).
# Ghostty sends Shift+Left/Right as CSI sequences; tmux reads them as S-Left /
# S-Right (needs `extended-keys on`, set above). No Ghostty option needed.
bind -n S-Left previous-window
bind -n S-Right next-window
# Status bar with transparent background (so rounded edges blend)
set -g status-style "bg=default,fg=#0e091d"
# Command prompt / message bar style
set -g message-style "bg=#ff7f41,fg=#0e091d"
set -g message-command-style "bg=#ff7f41,fg=#0e091d"
# Tree mode / selection highlight style (Ctrl+b s)
set -g mode-style "bg=#ff7f41,fg=#0e091d"
# Center the window list
set -g status-justify centre
# Left side: rounded pill
set -g status-left "#[fg=#ff7f41,bg=default]#(printf '\uE0B6')#[fg=#0e091d,bg=#ff7f41] #S #[fg=#ff7f41,bg=default]#(printf '\uE0B4')"
set -g status-left-length 50
# Right side: rounded pill with load-average and used-RAM metrics (macOS)
# - load average (1 min): sysctl -n vm.loadavg -> "{ 1.23 4.56 7.89 }"
# - used memory: top -l 1 -> "PhysMem: 12G used (...), 4G unused."
set -g status-right "#[fg=#ff7f41,bg=default]#(printf '\uE0B6')#[fg=#0e091d,bg=#ff7f41] #(printf '\uf4bc') #(sysctl -n vm.loadavg | awk '{print $2}') #(printf '\uefc5') #(top -l 1 -s 0 | awk '/PhysMem/ {print $2}') #[fg=#ff7f41,bg=default]#(printf '\uE0B4')"
set -g status-right-length 100
# Window status (centered, each window is a rounded pill)
# Inactive: inverted colors (dark bg, orange text)
set -g window-status-format "#[fg=#3a3a3a,bg=default]#(printf '\uE0B6')#[fg=#ff7f41,bg=#3a3a3a] #I:#W #[fg=#3a3a3a,bg=default]#(printf '\uE0B4') "
# Active: orange bg, black text
set -g window-status-current-format "#[fg=#ff7f41,bg=default]#(printf '\uE0B6')#[fg=#0e091d,bg=#ff7f41,bold] #I:#W #[fg=#ff7f41,bg=default]#(printf '\uE0B4') "
set -g window-status-separator " "
# 2-line status: empty line on top, actual bar on bottom
# Note: set -Fg trick broke in tmux 3.6a, so status-format[1] is set explicitly
set -g status 2
set -g 'status-format[0]' ''
set -g 'status-format[1]' "#[align=left range=left]#{E:status-left}#[norange default]#[list=on align=#{status-justify}]#{W:#{E:window-status-format},#{E:window-status-current-format}}#[nolist align=right range=right]#{E:status-right}#[norange default]"
# ─── Plugins (via TPM) ───
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
# Continuum: auto-save every 15 mins, auto-restore on tmux start
set -g @continuum-restore 'on'
set -g @continuum-save-interval '15'
# Resurrect: capture pane contents
set -g @resurrect-capture-pane-contents 'on'
# Pin TPM's plugin dir so it doesn't change based on which config path tmux
# loaded. When tmux loads its config from the XDG path (~/.config/tmux/tmux.conf),
# TPM otherwise auto-switches the plugin dir to ~/.config/tmux/plugins/ and
# silently fails to load plugins (resurrect/continuum) installed in ~/.tmux/plugins.
set-environment -g TMUX_PLUGIN_MANAGER_PATH "$HOME/.tmux/plugins/"
# Initialize TPM (keep this at the very bottom)
run '~/.tmux/plugins/tpm/tpm'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment