Tmux: Custom config - Alt/Meta+(arrow key) for switching between panes doesn't work #6681

Closed
opened 2026-01-31 00:44:38 +00:00 by claunia · 5 comments
Owner

Originally created by @atifraza on GitHub (Mar 1, 2020).

Environment

Windows build number: 10.0.18363.0
Windows Terminal version (if applicable): 0.9.433.0

Any other software?
WSL - Ubuntu 18.04

Steps to reproduce

I have a custom tmux config, where I defined Meta+arrows to switch between panes. The shortcuts work just fine when using the default terminal, however, with the Windows Terminal, the shortcut does not work in either WSL or when SSHed into a physical Ubuntu workstation.

Expected behavior

Add the following to your tmux.conf and use Alt+arrow to switch between panes (without, the prefix combination).

# 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

Actual behavior

The shortcut keys work while using the default (old) terminal, but do not work while WSL is using the new Windows Terminal.

Is this a key combination clash between some existing functionality? (I also found this issue #4460).

Originally created by @atifraza on GitHub (Mar 1, 2020). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> <!-- This bug tracker is monitored by Windows Terminal development team and other technical folks. **Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues**. Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue. If this is an application crash, please also provide a Feedback Hub submission link so we can find your diagnostic data on the backend. Use the category "Apps > Windows Terminal (Preview)" and choose "Share My Feedback" after submission to get the link. Please use this form and describe your issue, concisely but precisely, with as much detail as possible. --> # Environment ```none Windows build number: 10.0.18363.0 Windows Terminal version (if applicable): 0.9.433.0 Any other software? WSL - Ubuntu 18.04 ``` # Steps to reproduce I have a custom tmux config, where I defined Meta+arrows to switch between panes. The shortcuts work just fine when using the default terminal, however, with the Windows Terminal, the shortcut does not work in either WSL or when SSHed into a physical Ubuntu workstation. <!-- A description of how to trigger this bug. --> # Expected behavior Add the following to your tmux.conf and use Alt+arrow to switch between panes (without, the prefix combination). ``` # 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 ``` <!-- A description of what you're expecting, possibly containing screenshots or reference material. --> # Actual behavior The shortcut keys work while using the default (old) terminal, but do not work while WSL is using the new Windows Terminal. Is this a key combination clash between some existing functionality? (I also found this issue #4460). <!-- What's actually happening? -->
Author
Owner

@zadjii-msft commented on GitHub (Mar 2, 2020):

This is because those keys are actually bound by the Terminal by default to move focus within the Terminal's panes 😅 See their definition in the defaults here:

4608fd0b94/src/cascadia/TerminalApp/defaults.json (L215-L218)

If you want to unbind them, so that tmux can use those keys, you can add the following to your profiles.json

 { "command": "unbound", "keys": "alt+down" }, 
 { "command": "unbound", "keys": "alt+left" }, 
 { "command": "unbound", "keys": "alt+right" }, 
 { "command": "unbound", "keys": "alt+up" }, 

(alternatively, you could bind the moveFocus to another set of keys.)

@zadjii-msft commented on GitHub (Mar 2, 2020): This is because those keys are actually bound by the Terminal by default to move focus within the _Terminal_'s panes 😅 See their definition in the defaults here: https://github.com/microsoft/terminal/blob/4608fd0b94af2f4cf6ceec7b324ba36462e9c06b/src/cascadia/TerminalApp/defaults.json#L215-L218 If you want to unbind them, so that tmux can use those keys, you can add the following to your `profiles.json` ```json { "command": "unbound", "keys": "alt+down" }, { "command": "unbound", "keys": "alt+left" }, { "command": "unbound", "keys": "alt+right" }, { "command": "unbound", "keys": "alt+up" }, ``` (alternatively, you could bind the `moveFocus` to another set of keys.)
Author
Owner

@tjhowse commented on GitHub (Mar 18, 2020):

@atifraza Did this fix your problem? I have the same issue and @zadjii-msft's fix didn't work for me.

@tjhowse commented on GitHub (Mar 18, 2020): @atifraza Did this fix your problem? I have the same issue and @zadjii-msft's fix didn't work for me.
Author
Owner

@DHowett-MSFT commented on GitHub (Mar 18, 2020):

We may have broken key unbinding; #3729

@DHowett-MSFT commented on GitHub (Mar 18, 2020): We may have broken key _unbinding_; #3729
Author
Owner

@tjhowse commented on GitHub (Mar 18, 2020):

Oh beans! For what it's worth I've also tried { "command": null, "keys": "alt+down" } and got the same result.

Thanks for all your hard work!

@tjhowse commented on GitHub (Mar 18, 2020): Oh beans! For what it's worth I've also tried `{ "command": null, "keys": "alt+down" }` and got the same result. Thanks for all your hard work!
Author
Owner

@atifraza commented on GitHub (Mar 18, 2020):

@tjhowse I tried the key unbindings but that did not work. Since it was something new I was trying for tmux shortcut keys, I did not pursue it further.

@atifraza commented on GitHub (Mar 18, 2020): @tjhowse I tried the key unbindings but that did not work. Since it was something new I was trying for tmux shortcut keys, I did not pursue it further.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#6681