This skill helps you manage tmux, tmuxinator, and sesh sessions efficiently with templates, layouts, and quick switching.
npx playbooks add skill trentshaines/dotfiles --skill trent-tmux
This system uses tmux with tmuxinator templates and sesh for powerful session management.
~/.config/tmuxinator/*.yml~/.tmux.conf~/.zshrc (lines 37-72)tmux ls or sesh listtmuxinator start default ~/path~/.configCRITICAL: Pane Indexing
This tmux configuration uses 1-based indexing (set in ~/.tmux.conf):
set -g base-index 1 # Windows start at 1
set -g pane-base-index 1 # Panes start at 1
prefix + q (Ctrl+Space then q) to see pane numbers visuallyselect-pane -t 1 (not -t 0)Tmuxinator YAML Structure:
---
name: session-name # Fixed name (or use <%= File.basename(...) %> for dynamic)
root: ~/path # Working directory
on_project_start: tmux resize-pane -t name:0.0 -y 70% # Optional startup commands
windows:
- window-name:
layout: main-horizontal # or main-vertical, tiled, even-horizontal, etc.
panes:
- nvim # Command to run in pane 1
- # empty terminal # Empty pane (interactive shell) - pane 2
- claude --resume # Command for pane 3
Shell Function Structure (for creating windows dynamically):
tnw() {
# Get the session's root directory (uses 1-based indexing internally)
local session_path=$(tmux display-message -p '#{session_path}')
tmux new-window -c "$session_path" \; \
split-window -v -c "$session_path" \; \
split-window -v -c "$session_path" \; \
select-layout main-horizontal \; \
select-pane -t 1 \; \
send-keys 'nvim' C-m \; \
select-pane -t 3 \; \
send-keys 'claude --resume' C-m \; \
select-pane -t 2
}
Key points for both:
#{session_path} to get session root directory (not current pane path)send-keys 'command' C-m executes commands in panes (C-m = Enter)select-pane -t N focuses pane N (1-based)select-layout applies tmux built-in layoutsmain-horizontal - Top pane large, others stacked belowmain-vertical - Left pane large, others stacked righttiled - All panes equal sizeeven-horizontal - Panes side-by-side equal widtheven-vertical - Panes top-to-bottom equal heightts (tmux session selector)The ts function (defined in ~/.zshrc) is the main session switcher:
ts # Opens fzf with: "home" + tmuxinator templates + active sessions
ts Workssesh listsesh connecttmuxinator start <template>tmuxinator start default <name> (creates new project session)Template names come from the filename (e.g., admin.yml → "admin" in fzf), but the actual tmux session name comes from the name: field in the YAML file.
From ~/.zshrc:
ts # Tmux session selector (fzf for sessions/templates)
tns <name> # Tmux new session - create git project & open with tmuxinator
t [name] # Smart attach/create - attach if exists, create if not
ta <name> # Attach to session
tn <name> # Create new session
tls # List sessions
tk <name> # Kill session
tnw # Tmux new window - create window with 3-pane layout
# Layout: pane 1=nvim, pane 2=terminal (focused), pane 3=claude
# Bound to: prefix + N
tcopy # Copy tmux buffer to clipboard
tlines [n] # Copy last n lines from tmux pane to clipboard
ts # Use fzf to select session/template
tns myproject # Create ~/git/myproject with git + tmuxinator
tns myproject config # Use 'config' template instead of default
tmuxinator start admin # Start admin monitoring
tmuxinator start config # Edit dotfiles
tmuxinator start default ~/git/myproject # New project session with default template
tnw # Create new window with 3-pane layout in current session
prefix + N # Keybinding for tnw (Ctrl+Space then Shift+N)
prefix + c # Create empty new window (default tmux)
prefix + , # Rename current window
~/.config/tmuxinator/name.ymltmuxinator start namesf automaticallyOn terminal startup (from ~/.zshrc:272-275):
name: admin for consistent session names<%= File.basename(...) %> for project-based naming# interactive shell for clarityname: field in YAML vs filename.yml extension and not named "default"tmux kill-session -t name and restarton_project_start with tmux resize-pane commandsWeekly roundup of top Claude Code skills, MCP servers, and AI coding tips.