joshmedeski / sesh

Smart session manager for the terminal
MIT License
410 stars 16 forks source link

Connect/go to the previously connected session #112

Closed rtalexk closed 1 month ago

rtalexk commented 1 month ago

What would you like sesh to do?

It would be cool if there's a command or a flag for the connect command to go to the previous session, just like <prefix>l in Tmux for the last window, or :e # to edit the previous buffer in Vim. It would make it easier to navigate between sessions in case you are constantly working with two simultaneous sessions.

joshmedeski commented 1 month ago

This is a built-in feature for tmux:

L           Switch the attached client back to the last session.

I use <prefix>+L all the time :)

rtalexk commented 1 month ago

I didn't know this is already provided by Tmux. For the record, I use M+1, 2, 3, etc to switch for my most used sessions, i.e:

bind-key -n M-1 run-shell "sesh connect <current-project>"
bind-key -n M-1 run-shell "sesh connect <side-project>"
bind-key -n M-3 run-shell "sesh connect <notes>"
bind-key -n M-4 run-shell "sesh connect <configs>"

And I'm usually switching between my notes and a given session, so with @joshmedeski comment above, I added this additional mapping:

bind-key -n M-0 switch-client -l
joshmedeski commented 1 month ago

Great tips!

I use ⌘+l for "last" session