Skip to main content

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 the keys 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, META
KeyAssignment
required
The action to perform when the key combination is pressed.

Modifier Keys

  • SUPER maps to CMD on macOS and WIN on Windows/Linux
  • CMD and WIN are 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, Mapped
You can also specify keys using explicit physical or mapped notation:

Mouse 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.
This will show detailed information about key presses in the debug overlay (CTRL+SHIFT+L).

Complete Key Configuration Example

See Also