Using Alt-Left / Right to switch between windows in tmux

I am trying to configure tmux to switch between windows using alt-left, alt-right sequences. This is what I have in my .tmux.conf

bind-key -n M-Left previous-window bind-key -n M-Right next-window 

Unfortunately, it does not work. On my machine, alt-left and alt-right are associated with ^ [[1; 3D and ^ [[1; 3C respectively. I think I need to use terminfo override to tell tmux to use these sequences, but I have no idea how to do this. So any help would be appreciated.

Thanks!

+4
source share
1 answer

If the xterm-keys parameter is disabled, tmux will ignore the keys (because it will recognize them and cancel them if the option has not been set). tmux users were confused by this difference for a while, and at the end of 2016, the developer changed the default value for the option

 Change the xterm-keys option to default to on, so that tmux will generate xterm(1) escape sequences for function keys with modifiers. With the option off most of these keys are ignored by default, except for ctrl + arrows which use a variant that nothing else seems to use and I don't remember why we chose. The xterm escape sequences are now the most common. 

It still depends on the terminal description, as I pointed out in tmux on the remote machine, without getting the correct prefix + arrow keys

0
source

Source: https://habr.com/ru/post/1495785/


All Articles