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

keybindings.md

106 lines4.3 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​
8Use `mod+shift+m` to choose a model and `mod+shift+h` to choose a host.
9Use `mod+shift+e` for effort, `mod+shift+a` for access mode, `mod+shift+x` for the
10workspace, and `mod+shift+g` for the Git branch. The workspace menu includes the
11current checkout, a new worktree, and the previous worktree when available.
12Use `mod+shift+l` to reuse the previous worktree directly.
13​
14In the model picker, press Left in an empty search field or Shift+Tab to reach
15the provider list. Use Up/Down to move and Enter to choose. Right returns to
16model search. `mod+shift+up` and `mod+shift+down` switch providers directly and clear the
17search. These provider shortcuts can also be changed in Settings.
18​
19These shortcuts run inside the focused web or desktop client. `mod` uses Command
20on macOS and Ctrl on Windows and Linux, including GNOME, KDE Plasma, Niri, and
21Hyprland. If a custom desktop shortcut takes the same keys, choose another binding
22in Settings.
23​
24## Copy pull request references
25​
26With a PR open in the right panel or on the Pull Requests page, use `mod+shift+c`
27to copy its URL and `mod+shift+k` to copy its number with a `#` prefix.
28Both shortcuts can be changed in Settings. Search for “Copy PR URL or Thread ID”
29or “Copy Number”. They copy the selected PR and leave terminal input alone.
30​
31## Edit the configuration file
32​
33Keybindings live on the environment's machine, in
34`~/.t3/userdata/keybindings.json` by default. You can edit this file directly.
35It is a JSON array of rules:
36​
37```json
39 { "key": "mod+g", "command": "terminal.toggle" },
40 { "key": "mod+shift+g", "command": "terminal.new", "when": "terminalFocus" }
42```
43​
44T3 Code creates the file with its defaults and adds new defaults on later startups.
45New defaults do not replace commands you customized. If a new default overlaps one
46of your shortcuts, [rule order](#precedence) decides which runs.
47Invalid rules are ignored; if the file cannot be parsed, T3 Code uses defaults.
48​
49## Rule shape
50​
51Each rule requires a `key` shortcut and a `command` ID. An optional `when`
52expression restricts when it runs.
53​
54Project scripts use `script.{id}.run`, such as `script.test.run`.
55​
56## Key syntax
57​
58Join modifiers and a key with `+`, such as `mod+shift+d` or `ctrl+l`.
59`mod` means Command on macOS and Control elsewhere. Other modifiers are
60`cmd` / `meta`, `ctrl` / `control`, `alt` / `option`, and `shift`.
61​
62## When conditions
63​
64Available context keys are `terminalFocus`, `terminalOpen`, `previewFocus`,
65`previewOpen`, and `modelPickerOpen`. Unknown keys evaluate to `false`.
66​
67Combine keys with `!` for not, `&&` for and, `||` for or, and parentheses:
68​
69```json
70{ "key": "mod+j", "command": "terminal.toggle", "when": "terminalOpen && !terminalFocus" }
71```
72​
73## Precedence
74​
75The last rule whose key and condition both match wins, even if it belongs to a
76different command. Put a more specific rule after a general one when they share
77a shortcut.
78​
79## Commands with special behavior
80​
81`thread.stop` interrupts the running turn in the focused thread. It has no default
82shortcut; assign one in **Settings → Keybindings**.
83​
84`chat.new` may ask you to choose a project when there is more than one.
85`chat.newLocal` skips that chooser. Both use your
86[new-thread defaults](./thread-sidebar.md#start-a-thread).
87​
88## Reserved shortcuts
89​
90In the desktop app, `mod+w` closes the focused terminal or the active right-panel
91tab. When nothing remains to close, it closes the window. In a browser, `mod+w`
92closes the browser tab; rebind `rightPanel.close` and `terminal.close` to an available
93shortcut such as `alt+w`.
94​
95Many defaults include `!terminalFocus` so they do not intercept terminal input.
96Keep that condition when remapping them if you want the same behavior.
97​
98## Desktop quit shortcut
99​
100Use `Cmd+Q` on macOS or `Ctrl+Q` on Windows and Linux. In the default **Hold** mode,
101hold for 1.2 seconds or press twice within 500 milliseconds. Holding requires
102keyboard repeat; if repeat is disabled, use two presses or the application menu.
103​
104Change **Settings → General → Confirmations → Quit shortcut** to **Direct** for a
105single press or **Double press** for two presses only. Choosing **Quit** from the
106application menu always quits immediately.