Reputation: 51
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 Gr
or 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!
Upvotes: 5
Views: 8613
Reputation: 31
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
Upvotes: 3
Reputation: 19
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
Upvotes: 1