As I’ve become more comfortable with iTerm2, Vim and Tmux, I’ve found myself wishing that Tmux could do certain things. Then, after researching a bit, I find that Tmux *does* do that certain thing. Here is a quick little Tmux trick for nesting a session in a session.
Et voilà
First, we need to add a line to .tmux.conf, so that we have a different prefix for issuing commands to a nested Tmux sesh:
# nested tmux, obey me
bind-key a send-prefix
Next, once we’ve used the powerful Tmuxinator to start a Tmux session, we’ll start an additional Tmux session in one of our panes, first issuing the following command in the pane where we’d like the session to occur:
$ unset TMUX
Finally, we’ll bend the nested Tmux session to our will by using the nested prefix we defined in .tmux.conf:
C-a a
Notice that we’re sort of double-doing the Tmux command. Now we can cycle through windows and panes within our nested Tmux session. HIGHFIVE!