Terminal and workflow
Every shell runs inside tmux, with lazygit for git and a few scripts of mine. This page assumes:
- The tmux prefix is CTRL-A, so
Prefix |means CTRL-A, then|. - The From column says whether a key is the tool’s own or one my config adds. The last table lists every tmux key my config adds, generated from the config itself.
Contents
- Start or return to your session
- Split and move between panes
- Work with windows
- Switch or close sessions
- Copy text from the terminal
- Open a git worktree
- Read the status bar
- Stage, commit, and push with lazygit
- Look up a command
- Shell shortcuts
- Keys my config adds
Start or return to your session
Opening a terminal attaches to a tmux session named main, and creates it the first time. Every
terminal shares that session, so nothing is lost when one closes. To open a plain shell instead,
start it with NO_AUTO_TMUX=1.
| Do this | Press | From |
|---|---|---|
| Detach, leaving everything running | Prefix d |
tmux |
| Reload the tmux config after editing it | Prefix r |
mine |
| Send CTRL-A to the program, such as bash’s jump to the start of the line | Prefix CTRL-A |
mine |
Split and move between panes
New panes and windows open in the current pane’s folder. The mouse works too: click a pane to focus it, and drag a border to resize.
| Do this | Press | From |
|---|---|---|
| Split side by side | Prefix | |
mine |
| Split top and bottom | Prefix - |
mine |
| Focus the pane to the left | Prefix h |
mine |
| Focus the pane below | Prefix j |
mine |
| Focus the pane above | Prefix k |
mine |
| Focus the pane to the right | Prefix l |
mine |
| Zoom a pane to fill the window, and back | Prefix z |
tmux |
| Close a pane | Prefix x |
tmux |
Work with windows
Windows are numbered from 1, and closing one renumbers the rest.
| Do this | Press | From |
|---|---|---|
| Open a window | Prefix c |
mine |
| Go to window 1 to 9 | Prefix 1 to Prefix 9 |
tmux |
| Go to the previous window, holding to repeat | Prefix CTRL-H |
mine |
| Go to the next window, holding to repeat | Prefix CTRL-L |
mine |
| Go back to the last window | Prefix Backspace |
mine |
| Rename a window | Prefix , |
tmux |
Switch or close sessions
| Do this | Press | From |
|---|---|---|
| Choose a session or window from a tree | Prefix s |
mine |
| Kill the session, after confirming | Prefix X |
mine |
| Rename the session | Prefix $ |
tmux |
Copy text from the terminal
Copy mode moves through the pane’s history like Vim. A copy reaches the system clipboard, even in WSL or over SSH. Scrolling with the mouse also enters copy mode.
| Do this | Press | From |
|---|---|---|
| Enter copy mode | Prefix Enter |
mine |
| Start a selection | v |
mine |
| Select whole lines | V |
mine |
| Toggle a block selection | CTRL-V |
mine |
| Copy the selection and leave | y |
mine |
| Leave without copying | Escape |
mine |
Open a git worktree
Prefix e lists the current repo’s worktrees, most recent Claude Code session first, and opens
the one you pick in a new pane beside the current one. Outside tmux, run worktree-open for the
same list, and it opens a shell in the worktree you pick.
| Do this | Press | From |
|---|---|---|
| Pick a worktree and open it in a split | Prefix e |
mine |
Read the status bar
The bar lists the windows on the left, and marks a zoomed window with *. On the right, it names
Claude Code agents that want you: purple for one waiting on a reply, green for one that’s
finished. A yellow PREFIX appears while tmux is waiting for the key after CTRL-A.
Stage, commit, and push with lazygit
Run lazygit in a repo. Every key is lazygit’s own, and ? lists the ones for the panel you’re
in.
| Do this | Press | From |
|---|---|---|
| Stage or unstage the selected file | Space | lazygit |
| Stage or unstage everything | a |
lazygit |
| Stage part of a file, by opening its diff | Enter | lazygit |
| Commit | c |
lazygit |
| Amend the last commit | A |
lazygit |
| Push or pull | P or p |
lazygit |
| Undo the last git action | z |
lazygit |
| List the keys for this panel | ? |
lazygit |
| Quit | q |
lazygit |
Look up a command
cheatsheet tar prints a short cheat sheet for tar from cheat.sh. It works for most commands.
Shell shortcuts
vi and vim both open Neovim. ll lists files with sizes, and la adds hidden files. The prompt
shows the current folder, and the git branch when you’re in a repo.
Keys my config adds
| Key | Does | Where |
|---|---|---|
Prefix CTRL-A |
Send CTRL-A to the program in the pane | After the prefix |
Prefix r |
Reload the tmux config | After the prefix |
Prefix | |
Split the pane side by side | After the prefix |
Prefix - |
Split the pane top and bottom | After the prefix |
Prefix h |
Focus the pane to the left | After the prefix |
Prefix j |
Focus the pane below | After the prefix |
Prefix k |
Focus the pane above | After the prefix |
Prefix l |
Focus the pane to the right | After the prefix |
Prefix c |
Open a window in the current folder | After the prefix |
Prefix Backspace |
Go to the last window | After the prefix |
Prefix CTRL-H |
Go to the previous window (hold to repeat) | After the prefix |
Prefix CTRL-L |
Go to the next window (hold to repeat) | After the prefix |
Prefix Enter |
Enter copy mode | After the prefix |
v |
Start a selection | In copy mode |
V |
Select whole lines | In copy mode |
CTRL-V |
Toggle a block selection | In copy mode |
y |
Copy the selection to the clipboard | In copy mode |
Escape |
Leave copy mode | In copy mode |
Prefix s |
Choose a session or window from a tree | After the prefix |
Prefix e |
Open a git worktree in a split | After the prefix |
Prefix X |
Kill the session, after confirming | After the prefix |