Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
atifraza opened this issue Mar 1, 2020 · 5 comments
Labels
Area-Settings Issues related to settings and customizability, for console or terminal Issue-Question For questions or discussion Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Product-Terminal The new Windows Terminal. Resolution-Answered Related to questions that have been answered

Comments

@atifraza
Copy link

atifraza commented 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).

@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Mar 1, 2020
@atifraza atifraza changed the title Tmux: Custom config - M-(arrow key) for switching between panes doesn't work Tmux: Custom config - Alt/Meta+(arrow key) for switching between panes doesn't work Mar 1, 2020
@zadjii-msft
Copy link
Member

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:

{ "command": { "action": "moveFocus", "direction": "down" }, "keys": "alt+down" },
{ "command": { "action": "moveFocus", "direction": "left" }, "keys": "alt+left" },
{ "command": { "action": "moveFocus", "direction": "right" }, "keys": "alt+right" },
{ "command": { "action": "moveFocus", "direction": "up" }, "keys": "alt+up" },

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 zadjii-msft added Area-Settings Issues related to settings and customizability, for console or terminal Issue-Question For questions or discussion Product-Terminal The new Windows Terminal. Resolution-Answered Related to questions that have been answered labels Mar 2, 2020
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label Mar 2, 2020
@tjhowse
Copy link

tjhowse commented Mar 18, 2020

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

@DHowett-MSFT
Copy link
Contributor

We may have broken key unbinding; #3729

@tjhowse
Copy link

tjhowse commented 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!

@atifraza
Copy link
Author

@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 up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Settings Issues related to settings and customizability, for console or terminal Issue-Question For questions or discussion Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Product-Terminal The new Windows Terminal. Resolution-Answered Related to questions that have been answered
Projects
None yet
Development

No branches or pull requests

4 participants