I've been using tmux launched by default as part of my shell at all times for some time now and find it very convenient. At the same time ssh'ing from inside tmux to another system is not ideal because I end up with nested multiplexers. My solution has been to use different terminals — or rather the same terminal launched with different parameters so it doesn't start up up tmux and prompts me for a machine to ssh to instead.
This works, but it means that each terminal window is only good for the machine I launched it for. Detatching from tmux drops the terminal since it was exec'ed; likewise logout of the remote ssh session and the terminal drops.
Switching between tmux sessions is easy, I can change what session tmux is attached to from inside tmux. What I would like to do is have an option from inside tmux to ssh to another machine in a way that swaps out the main process in the shell from tmux to the ssh session. I could imagine two ways this might work:
- Swapping out the exec'ed process somehow.
- Enabling some sort of tmux feature that backgrounded the usual muli-pane interface and foregrounded another process passing all input/output through to it until it dies, then returning to the tmux session.
However I don't know if either is actually achievable. Or perhaps there is another way? How could this workflow be achieved?