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

keybindings.md

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