82 lines
3.0 KiB
Markdown
82 lines
3.0 KiB
Markdown
# Keybindings
|
|
|
|
Customize shortcuts in **Settings → Keybindings** on web and desktop. That page
|
|
also lists the command IDs and defaults available in your version.
|
|
|
|
## Edit the configuration file
|
|
|
|
Keybindings live on the environment's machine, in
|
|
`~/.t3/userdata/keybindings.json` by default. You can edit this file directly.
|
|
It is a JSON array of rules:
|
|
|
|
```json
|
|
[
|
|
{ "key": "mod+g", "command": "terminal.toggle" },
|
|
{ "key": "mod+shift+g", "command": "terminal.new", "when": "terminalFocus" }
|
|
]
|
|
```
|
|
|
|
T3 Code creates the file with its defaults and adds new defaults on later startups.
|
|
New defaults do not replace commands you customized. If a new default overlaps one
|
|
of your shortcuts, [rule order](#precedence) decides which runs.
|
|
Invalid rules are ignored; if the file cannot be parsed, T3 Code uses defaults.
|
|
|
|
## Rule shape
|
|
|
|
Each rule requires a `key` shortcut and a `command` ID. An optional `when`
|
|
expression restricts when it runs.
|
|
|
|
Project scripts use `script.{id}.run`, such as `script.test.run`.
|
|
|
|
## Key syntax
|
|
|
|
Join modifiers and a key with `+`, such as `mod+shift+d` or `ctrl+l`.
|
|
`mod` means Command on macOS and Control elsewhere. Other modifiers are
|
|
`cmd` / `meta`, `ctrl` / `control`, `alt` / `option`, and `shift`.
|
|
|
|
## When conditions
|
|
|
|
Available context keys are `terminalFocus`, `terminalOpen`, `previewFocus`,
|
|
`previewOpen`, and `modelPickerOpen`. Unknown keys evaluate to `false`.
|
|
|
|
Combine keys with `!` for not, `&&` for and, `||` for or, and parentheses:
|
|
|
|
```json
|
|
{ "key": "mod+j", "command": "terminal.toggle", "when": "terminalOpen && !terminalFocus" }
|
|
```
|
|
|
|
## Precedence
|
|
|
|
The last rule whose key and condition both match wins, even if it belongs to a
|
|
different command. Put a more specific rule after a general one when they share
|
|
a shortcut.
|
|
|
|
## Commands with special behavior
|
|
|
|
`thread.stop` interrupts the running turn in the focused thread. It has no default
|
|
shortcut; assign one in **Settings → Keybindings**.
|
|
|
|
`chat.new` may ask you to choose a project when there is more than one.
|
|
`chat.newLocal` skips that chooser. Both use your
|
|
[new-thread defaults](./thread-sidebar.md#start-a-thread).
|
|
|
|
## Reserved shortcuts
|
|
|
|
In the desktop app, `mod+w` closes the focused terminal or the active right-panel
|
|
tab. When nothing remains to close, it closes the window. In a browser, `mod+w`
|
|
closes the browser tab; rebind `rightPanel.close` and `terminal.close` to an available
|
|
shortcut such as `alt+w`.
|
|
|
|
Many defaults include `!terminalFocus` so they do not intercept terminal input.
|
|
Keep that condition when remapping them if you want the same behavior.
|
|
|
|
## Desktop quit shortcut
|
|
|
|
Use `Cmd+Q` on macOS or `Ctrl+Q` on Windows and Linux. In the default **Hold** mode,
|
|
hold for 1.2 seconds or press twice within 500 milliseconds. Holding requires
|
|
keyboard repeat; if repeat is disabled, use two presses or the application menu.
|
|
|
|
Change **Settings → General → Confirmations → Quit shortcut** to **Direct** for a
|
|
single press or **Double press** for two presses only. Choosing **Quit** from the
|
|
application menu always quits immediately.
|