Open History to see the last commit
1# Keybindings
2
3Edit keybindings from **Settings** → **Keybindings**. That page lists every command, its current
4shortcut, whether it is a default or your own, and warns about conflicts.
5
6The same configuration lives in `~/.t3/userdata/keybindings.json` on the machine running the
7server, if you prefer editing it directly. T3 Code writes the built-in defaults into that file on
8first run, and adds any new defaults on later startups unless a rule of yours already claims the
9command or the shortcut.
10
11The file is a JSON array of rules.
12
13```json
14[
15 { "key": "mod+g", "command": "terminal.toggle" },
16 { "key": "mod+shift+g", "command": "terminal.new", "when": "terminalFocus" }
17]
18```
19
20Invalid rules are ignored. An invalid file is ignored entirely, and the server logs a warning.
21
22## Rule Shape
23
24- `key` (required): shortcut string, like `mod+j`, `ctrl+k`, `cmd+shift+d`
25- `command` (required): the command ID to run
26- `when` (optional): boolean expression controlling when the shortcut is active
27
28## Key Syntax
29
30Modifiers: `mod` (`cmd` on macOS, `ctrl` elsewhere), `cmd` / `meta`, `ctrl` / `control`, `shift`,
31`alt` / `option`.
32
33Examples: `mod+j`, `mod+shift+d`, `ctrl+l`, `cmd+k`.
34
35## Commands
36
37Commands are IDs like `terminal.toggle`, `commandPalette.toggle`, `preview.refresh`, and
38`chat.new`. Project scripts are addressable as `script.{id}.run`, for example `script.test.run`.
39
40`filePicker.toggle` opens file search for the active project and defaults to `mod+p`.
41`projectSearch.toggle` searches inside the active project's files and defaults to `mod+shift+f`.
42Repeating either shortcut closes that search, and switching shortcuts replaces the open search.
43`themeEditor.toggle` opens or closes the floating theme editor and defaults to
44`mod+alt+shift+t`. Select a color label to spotlight the elements that use it; select the label
45again to clear the spotlight. The swatch and hex field keep that color selected while you edit it.
46Advanced mode groups related app tokens into a smaller set of color families. Changing a family
47updates its paired text and interaction states while leaving every unrelated imported color intact.
48Use **Inspect** to pick an element in the app and reveal its color token. Inspect disarms after one
49successful pick; its hover glow and badge preview the element and color family that click will select.
50**Cancel** or `Escape` exits Inspect and clears its selection and spotlight.
51
52`rightPanel.toggleMaximized` maximizes or restores the open right panel. It has no default shortcut,
53so add one in **Settings** → **Keybindings** if you want to use it.
54
55`thread.copyReference` copies the active thread's pull request link, or its thread ID when no pull
56request is available. Its default shortcut is `mod+shift+c`, and it does not replace terminal copy
57while the terminal has focus.
58
59`thread.settle` settles the active thread or restores it when it is already settled. Its default
60shortcut is `mod+shift+s`, and it does not run while the terminal has focus.
61
62`thread.pin` pins the active thread to the pinned section of the sidebar, or unpins it when it is
63already pinned. Its default shortcut is `mod+shift+p`, and it does not run while the terminal has
64focus. See [Organizing threads](./thread-sidebar.md) for how pinned threads are ordered.
65
66The command palette searches settings, active thread titles, projects, branches, user messages, and
67final agent responses across connected environments. A setting result opens its exact control or
68section. Message matches show one labeled excerpt while keeping the thread's project, branch, and
69machine context visible. Message search begins after two characters and uses SQLite's ASCII
70case-insensitive matching.
71
72The full command list and the current defaults are shown in **Settings** → **Keybindings**, which
73always matches the build you are running. Use that rather than a copied list.
74
75Note that `chat.new` and `chat.newLocal` both create a thread through the same path. A new thread
76inherits the project you were in, along with model and mode selections. Branch, worktree, and
77environment mode always come from your configured defaults, not from the thread you were looking
78at. To keep a worktree, use the explicit "new thread in this worktree" action in the branch
79toolbar. The only difference between the two commands: with the current sidebar and more than one
80project, `chat.new` opens a project chooser first.
81
82Background submission from a new thread is the exception. `mod+enter` starts that thread and opens
83another new thread with the same workspace mode and base branch. **New worktree** remains selected,
84but the new thread does not reuse the worktree created for the thread that just started.
85
86## `when` Conditions
87
88A `when` expression is evaluated against context keys describing the current UI state. The keys
89the app supplies today are `terminalFocus`, `terminalOpen`, `previewFocus`, `previewOpen`, and
90`modelPickerOpen`. The set is open and grows over time, so treat that as the current list rather
91than a fixed one. Any key the running app does not supply evaluates to `false`.
92
93Operators: `!` (not), `&&` (and), `||` (or), and parentheses.
94
95Examples:
96
97- `"when": "terminalFocus"`
98- `"when": "terminalOpen && !terminalFocus"`
99- `"when": "!terminalFocus"`
100
101## Precedence
102
103- Rules are evaluated in array order.
104- For a key event, the last rule where both `key` matches and `when` evaluates to `true` wins.
105- Precedence is across commands, not only within the same command. A later rule for a different
106 command can take a key away from an earlier one.