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

keybindings.md

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