How to switch to the previous pane by any shortcut in tmux? How to switch to the previous pane by any shortcut in tmux? linux linux

How to switch to the previous pane by any shortcut in tmux?


In tmux manual ($man tmux) you can find this section:

select-pane [-DdeLlRU] [-t target-pane]    (alias: selectp)    Make pane target-pane the active pane in window target-window.       If one of -D, -L, -R, or -U is used, respectively the pane below,    to the left, to the right, or above the target pane is used.  -l    is the same as using the last-pane command.  -e enables or -d    disables input to the pane.

So, I think what you want is to use the '-l' flag, which is for switch to last pane. I don't know if there is a default key mapping defined to this task, but you can accomplish this by doing your own bindings. Something like this:

bind -r <your key> select-pane -l


Copied from @lyuboslav-kanev

prefix + ; worked perfectly for me.

prefix + l switch to last window
prefix + L switch to last session