nvim/docs/tmux-cheatsheet.md
2025-11-04 01:38:54 -07:00

5.5 KiB

All tmux commands start with: Ctrl + w (custom config)

Starting & Managing Sessions

Command Action
tmux Start new session
tmux new -s name Start new session with name
tmux ls List all sessions
tmux attach Attach to last session
tmux attach -t name Attach to named session
tmux kill-session -t name Kill named session
tmux kill-server Kill all sessions

Inside tmux

Command Action
Ctrl + wd Detach from session (keeps running!)
Ctrl + ws List and switch sessions
Ctrl + w$ Rename current session

Windows

Command Action
Ctrl + wc Create new window
Ctrl + wn Next window
Ctrl + wp Previous window
Ctrl + w1-9 Switch to window 1-9
Ctrl + ww List all windows
Ctrl + w, Rename window
Ctrl + w& Kill window (asks for confirmation)
Ctrl + wl Last active window

Note: Window indexing starts at 1 (not 0) in this config


Panes

Creating Panes

Command Action
Ctrl + w% Split vertically (left/right)
Ctrl + w" Split horizontally (top/bottom)

Navigating Panes

Command Action
Ctrl + wh/j/k/l Move between panes (vim-style)
Ctrl + warrow keys Move between panes (also works)
Ctrl + wo Cycle through panes
Ctrl + wq Show pane numbers (press number to jump)
Ctrl + w; Toggle last active pane

Vim keybindings: h = left, j = down, k = up, l = right

Managing Panes

Command Action
Ctrl + wx Kill current pane
Ctrl + wz Zoom pane (fullscreen toggle)
Ctrl + w! Break pane into new window
Ctrl + w{ Swap with previous pane
Ctrl + w} Swap with next pane
Ctrl + wCtrl + arrow Resize pane
Ctrl + wSpace Cycle through pane layouts

Copy Mode (Scrolling & Copying)

Command Action
Ctrl + w[ Enter copy mode (scroll with arrows)
q or Esc Exit copy mode
Space Start selection (in copy mode)
Enter Copy selection
Ctrl + w] Paste
/ Search forward (in copy mode)
? Search backward (in copy mode)
n Next search result
N Previous search result

With mouse enabled: Just scroll normally! (Mouse is enabled in this config)


Help & Info

Command Action
Ctrl + w? Show all keybindings
Ctrl + wt Show clock (any key to exit)
Ctrl + wi Display pane info
tmux info Show tmux info (outside tmux)

Command Mode

Command Action
Ctrl + w: Enter command mode
Ctrl + wr Reload config (custom binding)

Useful Commands in Command Mode

:source-file ~/.tmux.conf    # Reload config (or just use Ctrl+w r)
:setw synchronize-panes on   # Type in all panes at once
:setw synchronize-panes off  # Disable sync
:resize-pane -D 10           # Resize down 10 lines
:resize-pane -U 10           # Resize up 10 lines

Troubleshooting

Problem Solution
Can't scroll Ctrl + w, [ for copy mode, or use mouse
Lost in panes Ctrl + w, q shows numbers
Forgot command Ctrl + w, ? shows all keybindings
Session stuck tmux kill-session -t name from outside
Config not working Ctrl + w, r to reload
Wrong colors Already set to tmux-256color in config