Saturday, August 22, 2015

How do I use Ctrl-Shift keyboard shortcuts for Tmux, with Cygwin/Mintty?



I want to use "1-step" keyboard shortcuts for Tmux, when used from Cygwin/Mintty. I can't get them to work, so for now I have to use the default "2-step" keyboard shortcuts for Tmux, which I don't like at all.



"1-step" shortcuts:





  • Ctrl+Shift+W

  • Ctrl+Shift+X



"2-step" ones:




  • press Alt+A, let go of Alt+A, press W

  • Alt+A, let go of Alt+A, press X




My previous setup was Cygwin + ConzoleZ, a Windows console with tabs and splits/panes. Unfortunately ConsoleZ still uses conhost.exe, the Windows console, with all its limitations. So I decided to use Mintty instead, which is a xterm-compatible console. However, Mintty doesn't have tabs or panes so I decided to use Tmux, since it can provide both.



However, due to console limitations, Tmux uses a command prefix which is the first "step" of any command. I've bound mine to Alt-a for convenience. So all the commands are Alt-a, let go of Alt-a, press something else. Not really ergonomic.



I've been checking the Mintty and Tmux documentation for anything that can help, but I'm probably still missing something.



So far I managed to bind Ctrl+Tab and Ctrl+Shift+Tab to rotate through tabs. I've also found that Mintty does emit some special escape sequences for the shortcuts I want to use (Ctrl+Shift+<...>). However, I don't know how to bind those to the commands I want.




I also saw that Tmux can have keyboard shortcuts without prefix, by using:



bind-key -n  


So in theory I'm really close.



The question is: how do I actually map the special escape sequences to commands? I think it should be doable using user-keys, just as in the example for Ctrl-Tab, but how can I list or otherwise see the Tmux escape sequence generated by Mintty for the keyboard shortcuts I want?



The list would be: Ctrl+Shift+\, Ctrl+Shift+-, Ctrl+Shift+X, Ctrl+Shift+T, Ctrl+Shift+W, Ctrl+Shift+→/↑/→/↓, Ctrl+Shift+Z, maybe a few others.



Answer



I am not using TMux, but I suspect you need to verify the Ctrl-Shift setting of Mintty



enter image description here


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...