Key Binding Configuration
WezTerm provides a powerful and flexible key binding system that allows you to customize keyboard shortcuts, create modal key tables, and configure leader keys.Basic Key Bindings
Defining Key Bindings
Key bindings are configured using thekeys configuration option:
array
default:"[]"
An array of key binding definitions. Each binding specifies a key, modifiers, and an action.
Key Binding Structure
Each key binding is a table with these fields:string
required
The key to bind. Can be a character (‘a’), named key (‘Enter’, ‘Tab’, ‘F1’), or keycode.
string
default:"''"
Modifier keys, combined with
|. Valid values: SHIFT, CTRL, ALT, SUPER, CMD, WIN, METAKeyAssignment
required
The action to perform when the key combination is pressed.
Modifier Keys
SUPERmaps toCMDon macOS andWINon Windows/LinuxCMDandWINare aliases and can be used interchangeably- Modifiers are case-insensitive
Common Key Actions
Tab Management
Pane Management
Copy and Paste
Font Size
Scrollback
Disabling Default Key Bindings
To start with a clean slate and define only your own key bindings:boolean
default:"false"
When true, WezTerm’s default key bindings are disabled.
Leader Key
A leader key works like in tmux - you press the leader key combination, then press another key within a timeout:table
default:"nil"
Configuration for the leader key. Includes the key, modifiers, and timeout.
When a key binding uses the
LEADER modifier, it requires pressing the leader key first.Key Tables
Key tables allow you to create modal key binding sets, similar to vim modes:table
default:"{}"
A table mapping key table names to arrays of key bindings.
Key Table Options
When activating a key table:string
required
The name of the key table to activate.
boolean
default:"true"
When true, the key table is automatically deactivated after one key press.
number
default:"nil"
Optional timeout after which the key table is automatically deactivated.
boolean
default:"false"
When true, replaces the current key table instead of stacking.
Physical vs Mapped Keys
string
default:"'Mapped'"
Controls whether keys are matched by physical position or mapped character. Valid values:
Physical, MappedMouse Bindings
You can also bind mouse events to actions:array
default:"[]"
An array of mouse binding definitions.
Disable Default Mouse Bindings
boolean
default:"false"
When true, WezTerm’s default mouse bindings are disabled.
Debug Key Events
boolean
default:"false"
When true, logs all key events to help debug key binding issues.
Complete Key Configuration Example
See Also
- Default Key Bindings - Complete list of default bindings
- Key Assignments Overview - All available actions
- Configuration Files - Configuration basics