Forked fromgitcafe/t3code
555 commits behind
KEYBINDINGS.md
Keybindings
T3 Code reads keybindings from:
~/.t3/keybindings.json
The file must be a JSON array of rules:
json
| 1 | [ |
| 2 | { "key": "mod+g", "command": "terminal.toggle" }, |
| 3 | { "key": "mod+shift+g", "command": "terminal.new", "when": "terminalFocus" } |
| 4 | ] |
See the full schema for more details: packages/contracts/src/keybindings.ts
Defaults
json
| 1 | [ |
| 2 | { "key": "mod+j", "command": "terminal.toggle" }, |
| 3 | { "key": "mod+d", "command": "terminal.split", "when": "terminalFocus" }, |
| 4 | { "key": "mod+n", "command": "terminal.new", "when": "terminalFocus" }, |
| 5 | { "key": "mod+w", "command": "terminal.close", "when": "terminalFocus" }, |
| 6 | { "key": "mod+n", "command": "chat.new", "when": "!terminalFocus" }, |
| 7 | { "key": "mod+shift+o", "command": "chat.new", "when": "!terminalFocus" }, |
| 8 | { "key": "mod+shift+n", "command": "chat.newLocal", "when": "!terminalFocus" }, |
| 9 | { "key": "mod+o", "command": "editor.openFavorite" } |
| 10 | ] |
For most up to date defaults, see DEFAULT_KEYBINDINGS in apps/server/src/keybindings.ts
Configuration
Rule Shape
Each entry supports:
key(required): shortcut string, likemod+j,ctrl+k,cmd+shift+dcommand(required): action IDwhen(optional): boolean expression controlling when the shortcut is active
Invalid rules are ignored. Invalid config files are ignored. Warnings are logged by the server.
Available Commands
terminal.toggle: open/close terminal drawerterminal.split: split terminal (in focused terminal context by default)terminal.new: create new terminal (in focused terminal context by default)terminal.close: close/kill the focused terminal (in focused terminal context by default)chat.new: create a new chat thread preserving the active thread's branch/worktree statechat.newLocal: create a new chat thread for the active project in a new environment (local/worktree determined by app settings (defaultlocal))editor.openFavorite: open current project/worktree in the last-used editorscript.{id}.run: run a project script by id (for examplescript.test.run)
Key Syntax
Supported modifiers:
mod(cmdon macOS,ctrlon non-macOS)cmd/metactrl/controlshiftalt/option
Examples:
mod+jmod+shift+dctrl+lcmd+k
when Conditions
Currently available context keys:
terminalFocusterminalOpen
Supported operators:
!(not)&&(and)||(or)- parentheses:
()
Examples:
"when": "terminalFocus""when": "terminalOpen && !terminalFocus""when": "terminalFocus || terminalOpen"
Unknown condition keys evaluate to false.
Precedence
- Rules are evaluated in array order.
- For a key event, the last rule where both
keymatches andwhenevaluates totruewins. - That means precedence is across commands, not only within the same command.