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

keybindings.md

221 lines10.8 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​
6To free a default shortcut for another command, choose **Unassign** from its row's
7actions menu. **Reset to default** brings it back.
8​
9## Composer controls
10​
11`mod+shift+d` starts dictation in the focused editor, or the composer, and finishes it on the next press;
12`Esc` discards the recording. Change the chord under **Composer: Start or Finish
13Dictation**, and the hold or toggle behavior in **Settings → Voice**. See
14[Voice input](./voice-input.md).
15​
16In **Settings → Chat → Send shortcut**, choose whether Enter sends, requires
17`mod+Enter` for multiline prompts, or always requires `mod+Enter`. `Shift+Enter`
18inserts a new line. This applies to the web and desktop composer at desktop widths.
19​
20**Follow-up behavior** chooses Queue or Steer while the agent runs. Use
21`mod+Enter` to do the opposite for one message, even when the send shortcut
22requires a modifier. `mod+Alt+Enter` sends, keeps that thread running in the
23background, and opens a fresh new-thread composer. In a new thread, `mod+Enter`
24does the same. Change these shortcuts in **Settings → Keybindings** under
25**Composer: Opposite Queue or Steer Action**, **Composer: Start in Background**,
26or **Composer: Send and Start New Thread**. These bindings take priority over the
27send shortcut. Click the send button to use the configured follow-up behavior.
28​
29When a thread has queued messages, `mod+Shift+Enter` sends the first one as a steer
30while a turn is running, or as a new turn when the thread is stopped. Change it under
31**Queue: Send First Queued Message** in Keybindings.
32​
33Use `mod+shift+m` to choose a model and `mod+shift+h` to choose a host.
34To step a new thread to the next machine instead of opening the menu, bind
35**Composer: Cycle Host** in Keybindings. It has no default shortcut.
36Use `mod+shift+e` for effort, `mod+shift+a` for permissions, `mod+shift+x` for the
37workspace, and `mod+shift+g` for the Git branch. The workspace menu includes the
38current checkout, a new worktree, and the previous worktree when available.
39Use `mod+shift+l` to reuse the previous worktree directly.
40​
41To change effort one step without opening the picker, bind
42**Composer: Increase Effort** and **Composer: Decrease Effort** in Keybindings.
43Both are unbound by default. Increase wraps from the highest level to the
44lowest, and decrease wraps from the lowest level to the highest.
45​
46In the model picker, press Left in an empty search field or Shift+Tab to reach
47the provider list. Use Up/Down to move and Enter to choose. Right returns to
48model search. Right at the end of the search moves to the highlighted model's effort
49levels, and Left comes back. Choosing a model keeps the picker open on its effort. `mod+shift+up` and `mod+shift+down` switch providers directly and clear the
50search. These provider shortcuts can also be changed in Settings.
51​
52These shortcuts run inside the focused web or desktop client. `mod` uses Command
53on macOS and Ctrl on Windows and Linux, including GNOME, KDE Plasma, Niri, and
54Hyprland. If a custom desktop shortcut takes the same keys, choose another binding
55in Settings.
56​
57## Copy pull request references
58​
59With a PR open in the right panel or on the Pull requests page, use `mod+shift+c`
60to copy its URL and `mod+shift+k` to copy its number with a `#` prefix.
61Both shortcuts can be changed in Settings. Search for “Copy Link or Thread”
62or “Copy Number”. They copy the selected PR and leave terminal input alone.
63Without a PR, `mod+shift+c` copies the thread itself, which pastes into a
64composer as a thread chip.
65​
66## Find in a diff
67​
68Click into a diff in the Diff panel or a pull request's Code tab, then press
69`mod+f` to search every file in it, including folded files and unchanged lines
70hidden between changes. Enter and `Shift+Enter` move between matches, and a
71match in a folded file opens it. Escape closes the search. This shortcut is not
72configurable. A very large uncommitted diff loads its files as you scroll, and
73find only searches the files loaded so far.
74​
75## iPad
76​
77With a hardware keyboard, use `Cmd+1` through `Cmd+9` to open the first nine
78displayed threads. The shortcuts follow the current list filters and order.
79`Cmd+K` opens the command palette to search commands, projects, and threads.
80Use the arrow keys and Return to choose a result, or `Cmd+1` through `Cmd+9` to
81choose directly. Escape or `Cmd+K` closes the palette. Start a search with `>`
82to show only actions.
83​
84In a new thread, `Cmd+Shift+H` moves the draft to the next machine.
85​
86In the composer, Return sends and `Shift+Return` inserts a new line. While a
87turn is running, `Cmd+Return` sends with the other follow-up action. To make
88Return insert a new line instead, change the Return key behavior in Settings →
89Keyboard; `Cmd+Return` then sends.
90​
91## Android
92​
93With a hardware keyboard, the composer handles Return as on iPad, with `Ctrl` in
94place of `Cmd`. The on-screen keyboard's Return always inserts a new line.
95​
96## Edit the configuration file
97​
98Keybindings live on the environment's machine, in
99`~/.t3/userdata/keybindings.json` by default. You can edit this file directly.
100It is a JSON array of rules:
101​
102```json
104 { "key": "mod+g", "command": "terminal.toggle" },
105 { "key": "mod+shift+g", "command": "terminal.new", "when": "terminalFocus" }
107```
108​
109T3 Code creates the file with its defaults and adds new defaults on later startups.
110New defaults do not replace commands you customized. If a new default overlaps one
111of your shortcuts, [rule order](#precedence) decides which runs.
112Invalid rules are ignored; if the file cannot be parsed, T3 Code uses defaults.
113​
114## Rule shape
115​
116Each rule requires a `key` shortcut and a `command` ID. An optional `when`
117expression restricts when it runs.
118​
119Project scripts use `script.{id}.run`, such as `script.test.run`.
120​
121## Key syntax
122​
123Join modifiers and a key with `+`, such as `mod+shift+d` or `ctrl+l`.
124`mod` means Command on macOS and Control elsewhere. Other modifiers are
125`cmd` / `meta`, `ctrl` / `control`, `alt` / `option`, and `shift`.
126​
127## When conditions
128​
129Available context keys are `terminalFocus`, `terminalOpen`, `previewFocus`,
130`previewOpen`, `rightPanelOpen`, `modelPickerOpen`, `usagePageOpen`, `composerFocus`,
131`draftThreadRoute`, `turnRunning`, `editableFocus`, `isWeb`, and `isDesktop`.
132In a thread, `rightPanelOpen` is true while its right panel is open; the default
133`mod+t` uses it to open the panel's new-tab menu.
134`draftThreadRoute` is true on a draft thread, including a restored draft, until it is first sent.
135`editableFocus` is true while a text field, the composer, or another editor has
136the keyboard. `isWeb` is true in a browser tab. `isDesktop` is true in the
137desktop app. Unknown keys evaluate to `false`.
138​
139`mod+1` through `mod+9` jump to the first nine threads, and to models while the
140model picker is open. The thread jumps do not run while the model picker is open.
141Those defaults use `isDesktop` so they do not steal the
142browser's tab-switch shortcuts. Remove that condition in Settings if you want
143the same jumps in a browser.
144​
145Combine keys with `!` for not, `&&` for and, `||` for or, and parentheses:
146​
147```json
148{ "key": "mod+j", "command": "terminal.toggle", "when": "terminalOpen && !terminalFocus" }
149```
150​
151## Find in the current thread
152​
153`chat.find` searches conversation messages and proposed plans in the active thread. Entering a
154query searches the entire thread, including older messages. Thread search requires server support;
155update an older server to enable it. Select **Retry** if a search fails. It defaults to
156`mod+f` outside terminals and previews. Press **Enter** or **Shift+Enter** to move between matches,
157and **Escape** to close find.
158​
159## Find on a browser page
160​
161`preview.find` (`mod+f` while a browser has focus) searches the open page in the desktop app. It
162is also in the browser's **⋮** menu and the command palette. A page that handles `mod+f` itself,
163such as a code editor, keeps its own find. Use the **⋮** menu to reach the browser's find there.
164Streamed browser tabs and T3 Code in a web browser do not support it.
165​
166## Precedence
167​
168The last rule whose key and condition both match wins, even if it belongs to a
169different command. Put a more specific rule after a general one when they share
170a shortcut.
171​
172## Commands with special behavior
173​
174`thread.stop` interrupts the running turn in the focused thread. It has no default
175shortcut; assign one in **Settings → Keybindings**.
176​
177`thread.regenerateTitle` generates a new title for the focused thread, like
178**Regenerate title** in the thread menu. It has no default shortcut.
179​
180`thread.undo` (`mod+z` by default) reverses the actions shown in the notice at the
181bottom of the sidebar, such as unpin, settle, snooze, archive, or discarding a
182draft. Consecutive
183actions of the same kind undo together. The notice remains available for five
184seconds after the latest action. Right after an action, the shortcut works even
185in a text field such as the composer. Once you type or press another key, the
186field gets its own undo back. Terminals always keep their native shortcut.
187​
188`navigation.back` (`mod+[` by default) and `navigation.forward` (`mod+]`) move
189through the pages you have visited, like a browser's back and forward buttons.
190​
191`chat.new` may ask you to choose a project when there is more than one.
192`chat.newLocal` skips that chooser. Both use your
193[new-thread defaults](./thread-sidebar.md#start-a-thread). `chat.newWithoutProject`
194(`mod+alt+n`) starts a thread [without a project](./thread-sidebar.md#start-without-a-project).
195​
196## Reserved shortcuts
197​
198In the desktop app, `mod+w` closes the focused terminal or the active right-panel
199tab. When nothing remains to close, it does nothing; it never closes the window. In a browser, `mod+w`
200closes the browser tab; rebind `rightPanel.close` and `terminal.close` to an available
201shortcut such as `alt+w`.
202​
203`mod+shift+t` reopens the last closed tab across the app, including files,
204diffs, pull requests, browsers, and devices, in the order you closed them.
205A browser opens in a fresh session without its old page history. Incognito tabs
206can reopen until you reload or quit the app. This shortcut does not undo deleted work.
207Browsers also use it to reopen browser tabs; choose another binding in Settings
208if the browser takes it first.
209​
210Many defaults include `!terminalFocus` so they do not intercept terminal input.
211Keep that condition when remapping them if you want the same behavior.
212​
213## Desktop quit shortcut
214​
215Use `Cmd+Q` on macOS or `Ctrl+Q` on Windows and Linux. In the default **Hold** mode,
216hold for 1.2 seconds or press twice within 500 milliseconds. Holding requires
217keyboard repeat; if repeat is disabled, use two presses or the application menu.
218​
219Change **Settings → General → Confirmations → Quit shortcut** to **Direct** for a
220single press or **Double press** for two presses only. Choosing **Quit** from the
221application menu always quits immediately.