11

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

15

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
6

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
...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.