3

I am using tmux version 3.1c. The command to switch to the previous window in tmux is the following:

Ctrl-a + M + p

However, my "meta-key" M, which I think should be Alt Gror Alt, won't trigger (at some point I came across ESC as my meta-key but this is too confusing). Therefore, I want to easily replace switching to the previous window this with the command

Ctrl-a + p

And switching to the next window with

Ctrl-a + n

where Ctrl-a is my own prefix. How would this be possible? I was trying to change it inside my .tmux.conf file, but didn't got the expected result. Thanks in advance!

derUeberBoss
  • 31
  • 1
  • 4

2 Answers2

3

Great answer by punyakoti, to build on that.

You can re-select the active window by adding select-window after the swap.

bind-key -n C-S-Left swap-window -t -1\; select-window -t -1
bind-key -n C-S-Right swap-window -t +1\; select-window -t +1
  • 1
    Hi, prefer using a comment under the related answer when adding relevant but minor or incremental information to a post. – ju95ju Mar 11 '22 at 09:07
1

I have this in my tmux.conf

#urxvt tab like window switching 
bind -n S-down new-window
bind -n S-left prev
bind -n S-right next

To switch the location of the tabs:

#Swapping Tmux windows
bind-key -n C-S-Left swap-window -t -1
bind-key -n C-S-Right swap-window -t +1
punyakoti
  • 29
  • 4