Macterm

Copy Mode

Copy mode lets you move through the scrollback and select text with the keyboard. It is the copy mode of tmux and the vi mode of Alacritty. The keys are the keys of Vim. A setting gives you the keys of Helix instead.

Press ⌘⇧Space in a pane to start it. The cursor becomes a block that you move, and a Copy Mode pill appears in the corner of the pane. A click on the pill also leaves the mode. Press Esc to leave it. The cursor goes back to where the shell left it, and the pane types into the shell again.

While copy mode is on, the keys of the pane move the selection and do not reach the shell. ⌘ keys still work: ⌘C copies the selection, ⌘W closes the pane.

Vim keys

Copy mode works as the vi copy mode of tmux. A motion moves the cursor. Visual mode starts a selection, and the motions then grow it.

Key Motion
h j k l, arrows One cell left or right, one row up or down
w e b The start of the next word, the end of the word, the start of the word
0 ^ $, Home End The start of the row, the last character of the row
gg G The top of the scrollback, the last character on the screen
⌃u ⌃d ⌃b ⌃f, Page Up Page Down Half a screen, a screen

A number before a motion repeats it: 5j moves down five rows.

Key Selection
v Start or stop visual mode. The pill says Visual
V Visual line mode: whole lines. The pill says Visual Line
⌃v Visual block mode: a rectangle. The pill says Visual Block
o Swap the two ends of the selection
y In visual mode: copy the selection and leave copy mode
yy Y Copy the line of the cursor and leave copy mode
/ n N Search, the next match, the previous match
Esc Leave visual mode, then leave copy mode
q Leave copy mode

A word is a run of letters, or a run of punctuation. Spaces and the end of a line separate words. The characters in the Ghostty key selection-word-chars count as punctuation.

Helix keys

Go to Settings → Keymaps → Copy Mode and select Helix. The change applies the next time copy mode starts. Copy mode then uses the model of Helix. There is always a selection. Its head is the cursor, the end that the motions move. Its anchor is the other end.

Key Motion
h j k l, arrows One cell left or right, one row up or down
w To the start of the next word
e To the end of the word
b To the start of the word
gh gl, Home End The start of the row, the last character of the row
gg ge The top of the scrollback, the last character on the screen
⌃u ⌃d Half a screen up or down
⌃b ⌃f, Page Up Page Down A screen up or down

A number before a motion repeats it.

Key Selection
v Start or stop select mode
x Select the whole line. Press it again to add the next line
% Select everything
; Collapse the selection to the head
⌥; Swap the anchor and the head
y Copy the selection to the clipboard and leave copy mode
/ Open the search bar. The match becomes the selection
n N The next or the previous match
Esc Leave select mode, then leave copy mode

The mouse still works with both keymaps. A click moves the cursor to the cell under the pointer, a drag makes a selection, and the next motion continues from there.

The keybind

Copy Mode is a row in Settings → Keymaps. Change its keys there. It is also in the command palette and in the View menu.

The keys inside copy mode are the Vim keys or the Helix keys (Settings → Keymaps → Copy Mode). You cannot change single keys.

Notes