0
votes

I am trying to create new arrow key bindings in TMUX which is running on a Linux machine. I ssh to that machine from my Mac (Mojave 10.14.6) using the Terminal. These are all combinations that I added in ~/.tmux.conf:

# Use Shift-Arrow to move between panes
bind -T root C-Left select-pane -L
bind -T root C-Right select-pane -R
bind -T root C-Up select-pane -U
bind -T root C-Down select-pane -D

# Use Alt-Shift Left/Right to switch between tabs
bind -T root M-C-Left previous-window
bind -T root M-C-Right next-window

# Use Alt-Shift Up/Down to create/close a tab
bind -T root M-C-Up new-window
bind -T root M-C-Down kill-pane

It works for Ctrl+Left and Ctrl+Right, but not for the others. For the Up/Down arrow combinations it always goes through the Terminal history, so I think that Terminal is overriding these bindings. However, I can not find where it does so, I removed all relevant combinations from Preferences -> Profiles -> Keyboard and also from System Preferences -> Keyboard -> Shortcuts. For the M-C-Left/Right nothing happens.

I believe the TERM variable is set correctly:

TERM=xterm-256color
TERM_PROGRAM=Apple_Terminal
TERM_PROGRAM_VERSION=421.2
TERM_SESSION_ID=782B88DE-A8DA-4542-8428-F9D5C1EF6386

The key bindings are also listed when calling tmux list-keys. When pressing the combinations in cat, I get:

cat
  ^[[A  (Ctrl+Up)
  ^[[B  (Ctrl+Down)
  ^[^[[C  (Ctrl+Option+Right)
  ^[^[[D  (Ctrl+Option+Left)
  ^[^[[A  (Ctrl+Option+Up)
  ^[^[[B  (Ctrl+Down)
2

2 Answers

1
votes

Just try to reload the config. Kill definitely your tmux (tmux kill-server) and launch it with:

tmux source-file ~/.tmux.conf

or simply load the config in tmux command mode (Ctrl+B):

:source-file ~/.tmux.conf
0
votes

I think you should kill existing sessions after changing the configuration of tmux.

tmux kill-server

Now you can create new sessions which will have Changed configurations.