14

How could I bind to last (most recent) session? The obvious last-session leads to an "unknown command" error.

bind-key z last-session

2 Answers 2

17

Don't know about how to bind to the Eject key (it's too far from the home keys anyway!) but this will do the trick:

bind-key -n z switch-client -l
2
  • 1
    Doesn't this bind z to this action even without the tmux prefix? I'd prefer bind-key z switch-client -l so it's easier to type z into a terminal when it's needed. Nov 21, 2018 at 22:18
  • Do not use -n lol it'll be very bad each time you have to type z into the terminal.
    – geoyws
    Nov 21, 2022 at 2:27
9

In recent versions of tmux (e.g. 2.6) the key Prefix-L is already bound to the command switch-client -l which as user47464 pointed out is probably what you want.

You can check your bindings with Prefix-?:

...
bind-key    -T prefix       L                 switch-client -l
...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .