Skip to main content
Key bindings in tmux allow you to execute commands with keyboard shortcuts. Bindings can be customized to fit your workflow and are organized into key tables.

Key Binding Commands

bind-key

Create or modify key bindings:
Flags:
  • -n: Bind without requiring the prefix key (root table)
  • -r: Allow key to repeat without pressing prefix again
  • -T: Specify the key table (default: prefix)
  • -N: Add a descriptive note for the binding
Examples:
The bind-key command is implemented in cmd-bind-key.c:54-107 and uses the key_bindings_add() function to register bindings.

unbind-key

Remove key bindings:
Example:

list-keys

List all key bindings:
Flags:
  • -1: Show only one binding
  • -N: Show notes/descriptions
  • -T: Filter by key table

Key Tables

Key bindings are organized into tables. From key-bindings.c:104-123, tmux uses a red-black tree structure to manage key tables efficiently.

Built-in Key Tables

Using Key Tables

Default Key Bindings

tmux initializes default bindings in key_bindings_init() (key-bindings.c:347-669). Here are the most important defaults:

Session Management

Window Management

Pane Management

Layout Management

Copy Mode

Copy Mode Keys (Emacs)

Copy Mode Keys (Vi)

Mouse Bindings

tmux includes comprehensive mouse support (key-bindings.c:442-489):

Custom Binding Examples

Here are practical custom bindings from example_tmux.conf:

Function Key Bindings

Toggle Bindings

Prefix Key Customization

Key Codes

Keys can be specified in several formats:

Repeatable Bindings

The -r flag creates repeatable bindings. After pressing the binding once, you can press just the key (without prefix) within the repeat-time window:
From key-bindings.c:222-223, repeatable bindings are marked with the KEY_BINDING_REPEAT flag.

Listing and Describing Keys

Binding Best Practices

Don’t bind keys that conflict with your shell or text editor. For example, C-s is used by shell flow control.
Choose key bindings that are easy to remember. For example, r for reload, | for vertical split.
Use the -N flag to add notes to your custom bindings:
Changing key bindings doesn’t affect existing sessions until you reload the configuration or restart tmux.