Tmux Alt/Meta + Arrow keys don’t work on Windows Terminal

Putting this up ‘cos I will forget how to do this at some point in the future.

Say you’re using the following keybindings on tmux:

# switch panes using Alt-arrow without prefix
bind -n M-Left  select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up    select-pane -U
bind -n M-Down  select-pane -D

And they work okay on Windows Bash but they don’t work on Windows Terminal. This is the cause, and this is the solution:

// Add any keybinding overrides to this array.
// To unbind a default keybinding, set the command to "unbound"
"keybindings": [
    { "command": "unbound", "keys": "alt+down" }, 
                  { "command": "unbound", "keys": "alt+left" }, 
                  { "command": "unbound", "keys": "alt+right" }, 
                  { "command": "unbound", "keys": "alt+up" }
]

This will unbind all uses of the Alt key on the terminal itself and pass them on to tmux.

Leave a Comment

Your email address will not be published. Required fields are marked *