Configuration File
Keybindings are configured in:If you’ve set a custom
T3CODE_STATE_DIR, the keybindings file will be located at $T3CODE_STATE_DIR/keybindings.json.File Format
The configuration file must be a JSON array of keybinding rules:keybindings.json
Rule Schema
Each keybinding rule has the following structure:The keyboard shortcut string.Format:
modifier+modifier+keyExamples:mod+jctrl+shift+kcmd+alt+d
The command to execute when the shortcut is pressed.See Available Commands below.
Optional boolean expression that determines when the shortcut is active.See When Conditions below.
Available Commands
Terminal Commands
terminal.toggle
terminal.toggle
Open or close the terminal drawer.
terminal.split
terminal.split
Split the current terminal into a new pane.Best used with
when: "terminalFocus" to only activate when terminal is focused.terminal.new
terminal.new
Create a new terminal tab.Best used with
when: "terminalFocus" to avoid conflicts.terminal.close
terminal.close
Close or kill the focused terminal.Best used with
when: "terminalFocus" to only activate when terminal is focused.Chat Commands
chat.new
chat.new
Create a new chat thread that preserves the active thread’s branch and worktree state.Best used with
when: "!terminalFocus" to avoid conflicts with terminal commands.chat.newLocal
chat.newLocal
Create a new local chat thread for the active project without worktree context.
Editor Commands
editor.openFavorite
editor.openFavorite
Open the current project or worktree in your last-used external editor.
Diff Commands
diff.toggle
diff.toggle
Toggle the diff viewer.
Project Script Commands
script.{id}.run
script.{id}.run
Run a project script by its ID.The script ID must match a script configured in your project settings. The ID must:
- Be 1-24 characters long
- Start with a lowercase letter or digit
- Contain only lowercase letters, digits, and hyphens
Key Syntax
Modifiers
T3 Code supports the following modifier keys:Platform-specific modifier:
Cmdon macOSCtrlon Windows/Linux
Command key (⌘) on macOS, ignored on other platforms.Alias:
metaControl key on all platforms.Alias:
controlShift key on all platforms.
Alt key (⌥ on macOS) on all platforms.Alias:
optionSpecial Keys
To bind the
+ key itself, use a trailing + in your shortcut: "mod+" (note the empty modifier after the plus).When Conditions
Thewhen field accepts boolean expressions to control when a keybinding is active.
Context Keys
True when a terminal pane has keyboard focus.
True when the terminal drawer is open.
Unknown context keys evaluate to
false.Operators
Precedence Rules
When multiple keybinding rules match a keyboard event:- Rules are evaluated in array order (top to bottom)
- The last matching rule wins where both
keymatches ANDwhenevaluates totrue - Precedence is across all commands, not just within the same command
mod+ncreates a new terminal when terminal is focusedmod+ncreates a new chat when terminal is not focused
Default Keybindings
T3 Code ships with these default keybindings:Default Keybindings
When you override a command in your custom configuration, the default keybinding for that command is automatically removed.
Configuration Validation
T3 Code validates your keybindings configuration:- Invalid rules are ignored - The server logs warnings for invalid entries
- Invalid files are ignored - If the entire file is malformed, defaults are used
- Maximum 256 keybindings - Exceeding the limit truncates oldest entries
Common Validation Errors
Invalid key syntax
Invalid key syntax
Invalid command format
Invalid command format
Invalid when expression
Invalid when expression
Live Reloading
Keybindings are watched for changes:- Edit
~/.t3/keybindings.json - Save the file
- Changes are automatically applied
- Invalid changes are logged to the server console
No server restart required! Changes take effect immediately.
Example Configurations
VS Code Style
VS Code-like keybindings
Vim-inspired
Vim-style keybindings
Project Scripts
Development workflow
Troubleshooting
Keybinding Not Working
- Check the server console for validation errors
- Verify the command name is correct
- Check if another rule with higher precedence is matching
- Ensure the
whencondition is met
File Not Being Watched
Reset to Defaults
Limits and Constraints
Configuration is truncated to the last 256 entries if exceeded.
Key strings longer than 64 characters are rejected.
When expressions longer than 256 characters are rejected.
When expressions deeper than 64 nested levels are rejected.
Script IDs in
script.{id}.run commands must be 24 characters or less.Related
Project Scripts
Configure project scripts for keybindings
Server Options
Server configuration and CLI flags
