Terminal and workflow
NAME
terminal - tmux, panes and the shell workflow
DESCRIPTION
Every shell runs inside tmux, with lazygit for git and a few custom scripts. 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 the dotfiles add. The last table lists every tmux key the dotfiles add, 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 the dotfiles add
Start or return to your session
Opening a terminal starts a tmux session of its own, numbered from 0 upward, and leaves the sessions already running alone.
Closing a terminal detaches it rather than ending it, so the shells inside and anything they
run keep going. Prefix X ends them after confirming, and Prefix s lists every session and
its windows, the way back to one you left. A killed session’s number is reused, so rename with
Prefix $ if you mean to find it again. For a shell outside tmux, start the terminal with
NO_AUTO_TMUX=1.
Everything between the window opening and the first prompt, including how the SSH key reaches the agent, is on session start.
| Do this | Press | From |
|---|---|---|
| Detach, leaving everything running | Prefix d |
tmux |
| Reload the tmux config after editing it | Prefix r |
dotfiles |
| Send CTRL-A to the program, such as bash’s jump to the start of the line | Prefix CTRL-A |
dotfiles |
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 | |
dotfiles |
| Split top and bottom | Prefix - |
dotfiles |
| Focus the pane to the left | Prefix h |
dotfiles |
| Focus the pane below | Prefix j |
dotfiles |
| Focus the pane above | Prefix k |
dotfiles |
| Focus the pane to the right | Prefix l |
dotfiles |
| 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 |
dotfiles |
| Go to window 1 to 9 | Prefix 1 to Prefix 9 |
tmux |
| Go to the previous window, holding to repeat | Prefix CTRL-H |
dotfiles |
| Go to the next window, holding to repeat | Prefix CTRL-L |
dotfiles |
| Go back to the last window | Prefix Backspace |
dotfiles |
| Rename a window | Prefix , |
tmux |
Switch or close sessions
| Do this | Press | From |
|---|---|---|
| Choose a session or window from a tree | Prefix s |
dotfiles |
| Kill the session, after confirming | Prefix X |
dotfiles |
| 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 |
dotfiles |
| Start a selection | v |
dotfiles |
| Select whole lines | V |
dotfiles |
| Toggle a block selection | CTRL-V |
dotfiles |
| Copy the selection and leave | y |
dotfiles |
| Leave without copying | Escape |
dotfiles |
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 |
dotfiles |
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 the dotfiles add
| 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 |