Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

keybindings.md

166 lines7.7 KB

1# Keybindings
2​
3Customize shortcuts in **Settings → Keybindings** on web and desktop. That page
4also lists the command IDs and defaults available in your version.
5​
6## Composer controls
7​
8In **Settings → General → Send shortcut**, choose whether Enter sends, requires
9`mod+Enter` for multiline prompts, or always requires `mod+Enter`. `Shift+Enter`
10inserts a new line. This applies to the web and desktop composer at desktop widths.
11​
12**Follow-up behavior** chooses Queue or Steer while the agent runs. Use
13`mod+Enter` to do the opposite for one message, even when the send shortcut
14requires a modifier. `mod+Alt+Enter` sends, keeps that thread running in the
15background, and opens a fresh new-thread composer. In a new thread, `mod+Enter`
16does the same. Change these shortcuts in **Settings → Keybindings** under
17**Composer: Opposite Queue or Steer Action**, **Composer: Start in Background**,
18or **Composer: Send and Start New Thread**. These bindings take priority over the
19send shortcut. Click the send button to use the configured follow-up behavior.
20​
21When an active turn has queued messages, `mod+Shift+Enter` sends the first as a
22steer. Change it under **Queue: Send First Queued Message as Steer** in Keybindings.
23​
24Use `mod+shift+m` to choose a model and `mod+shift+h` to choose a host.
25To step a new thread to the next machine instead of opening the menu, bind
26**Composer: Cycle Host** in Keybindings. It has no default shortcut.
27Use `mod+shift+e` for effort, `mod+shift+a` for access mode, `mod+shift+x` for the
28workspace, and `mod+shift+g` for the Git branch. The workspace menu includes the
29current checkout, a new worktree, and the previous worktree when available.
30Use `mod+shift+l` to reuse the previous worktree directly.
31​
32In the model picker, press Left in an empty search field or Shift+Tab to reach
33the provider list. Use Up/Down to move and Enter to choose. Right returns to
34model search. `mod+shift+up` and `mod+shift+down` switch providers directly and clear the
35search. These provider shortcuts can also be changed in Settings.
36​
37These shortcuts run inside the focused web or desktop client. `mod` uses Command
38on macOS and Ctrl on Windows and Linux, including GNOME, KDE Plasma, Niri, and
39Hyprland. If a custom desktop shortcut takes the same keys, choose another binding
40in Settings.
41​
42## Copy pull request references
43​
44With a PR open in the right panel or on the Pull Requests page, use `mod+shift+c`
45to copy its URL and `mod+shift+k` to copy its number with a `#` prefix.
46Both shortcuts can be changed in Settings. Search for “Copy Link or Thread ID”
47or “Copy Number”. They copy the selected PR and leave terminal input alone.
48​
49## iPad
50​
51With a hardware keyboard, use `Cmd+1` through `Cmd+9` to open the first nine
52displayed threads. The shortcuts follow the current list filters and order.
53`Cmd+K` opens the command palette to search commands, projects, and threads.
54Use the arrow keys and Return to choose a result, or `Cmd+1` through `Cmd+9` to
55choose directly. Escape or `Cmd+K` closes the palette. Start a search with `>`
56to show only actions.
57​
58In a new thread, `Cmd+Shift+H` moves the draft to the next machine.
59​
60In the composer, Return sends and `Shift+Return` inserts a new line. `Cmd+Return`
61also sends. To make Return insert a new line instead, change the Return key
62behavior in Settings → Keyboard.
63​
64## Edit the configuration file
65​
66Keybindings live on the environment's machine, in
67`~/.t3/userdata/keybindings.json` by default. You can edit this file directly.
68It is a JSON array of rules:
69​
70```json
72 { "key": "mod+g", "command": "terminal.toggle" },
73 { "key": "mod+shift+g", "command": "terminal.new", "when": "terminalFocus" }
75```
76​
77T3 Code creates the file with its defaults and adds new defaults on later startups.
78New defaults do not replace commands you customized. If a new default overlaps one
79of your shortcuts, [rule order](#precedence) decides which runs.
80Invalid rules are ignored; if the file cannot be parsed, T3 Code uses defaults.
81​
82## Rule shape
83​
84Each rule requires a `key` shortcut and a `command` ID. An optional `when`
85expression restricts when it runs.
86​
87Project scripts use `script.{id}.run`, such as `script.test.run`.
88​
89## Key syntax
90​
91Join modifiers and a key with `+`, such as `mod+shift+d` or `ctrl+l`.
92`mod` means Command on macOS and Control elsewhere. Other modifiers are
93`cmd` / `meta`, `ctrl` / `control`, `alt` / `option`, and `shift`.
94​
95## When conditions
96​
97Available context keys are `terminalFocus`, `terminalOpen`, `previewFocus`,
98`previewOpen`, `modelPickerOpen`, `usagePageOpen`, `composerFocus`, `composerDraft`,
99`turnRunning`, `editableFocus`, `isWeb`, and `isDesktop`.
100`editableFocus` is true while a text field, the composer, or another editor has
101the keyboard. `isWeb` is true in a browser tab. `isDesktop` is true in the
102desktop app. Unknown keys evaluate to `false`.
103​
104`mod+1` through `mod+9` jump to the first nine threads, and to models while the
105model picker is open. Those defaults use `isDesktop` so they do not steal the
106browser's tab-switch shortcuts. Remove that condition in Settings if you want
107the same jumps in a browser.
108​
109Combine keys with `!` for not, `&&` for and, `||` for or, and parentheses:
110​
111```json
112{ "key": "mod+j", "command": "terminal.toggle", "when": "terminalOpen && !terminalFocus" }
113```
114​
115## Precedence
116​
117The last rule whose key and condition both match wins, even if it belongs to a
118different command. Put a more specific rule after a general one when they share
119a shortcut.
120​
121## Commands with special behavior
122​
123`thread.stop` interrupts the running turn in the focused thread. It has no default
124shortcut; assign one in **Settings → Keybindings**.
125​
126`thread.undo` (`mod+z` by default) reverses the actions shown in the notice at the
127bottom of the sidebar, such as unpin, settle, snooze, archive, or discarding a
128draft. Consecutive
129actions of the same kind undo together. The notice remains available for five
130seconds after the latest action. The default shortcut skips text fields and
131terminals so native undo keeps working there.
132​
133`navigation.back` (`mod+[` by default) and `navigation.forward` (`mod+]`) move
134through the pages you have visited, like a browser's back and forward buttons.
135​
136`chat.new` may ask you to choose a project when there is more than one.
137`chat.newLocal` skips that chooser. Both use your
138[new-thread defaults](./thread-sidebar.md#start-a-thread). `chat.newWithoutProject`
139(`mod+alt+n`) starts a thread [without a project](./thread-sidebar.md#start-without-a-project).
140​
141## Reserved shortcuts
142​
143In the desktop app, `mod+w` closes the focused terminal or the active right-panel
144tab. When nothing remains to close, it closes the window. In a browser, `mod+w`
145closes the browser tab; rebind `rightPanel.close` and `terminal.close` to an available
146shortcut such as `alt+w`.
147​
148`mod+shift+t` reopens the last closed tab across the app, including files,
149diffs, pull requests, browsers, and devices, in the order you closed them.
150A browser opens in a fresh session without its old page history. Incognito tabs
151can reopen until you reload or quit the app. This shortcut does not undo deleted work.
152Browsers also use it to reopen browser tabs; choose another binding in Settings
153if the browser takes it first.
154​
155Many defaults include `!terminalFocus` so they do not intercept terminal input.
156Keep that condition when remapping them if you want the same behavior.
157​
158## Desktop quit shortcut
159​
160Use `Cmd+Q` on macOS or `Ctrl+Q` on Windows and Linux. In the default **Hold** mode,
161hold for 1.2 seconds or press twice within 500 milliseconds. Holding requires
162keyboard repeat; if repeat is disabled, use two presses or the application menu.
163​
164Change **Settings → General → Confirmations → Quit shortcut** to **Direct** for a
165single press or **Double press** for two presses only. Choosing **Quit** from the
166application menu always quits immediately.