This is a simple tmux configuration enabling to have arbitrarily many nested tmux sessions.
mkdir ~/.tmux.conf.d/
cd ~/.tmux.conf.d/
git clone https://github.com/aleclearmind/nested-tmux.git
mv ~/.tmux.conf ~/.tmux.conf.backup
echo "source ~/.tmux.conf.d/nested-tmux/active-row.conf" > ~/.tmux.conf
tmux
Ctrl + a, Ctrl + corCtrl + t: create a new windowCtrl + a, Ctrl + s: create a new nested tmux session and ask a name for itCtrl + a, Ctrl + A: switch to last windowCtrl + a, A: rename current windowAlt + Right: move to the next window of the current rowAlt + Left: move to the previous window of the current rowAlt + Up: move to the inner tmux sessionAlt + Down: move to the outer tmux session
-
Q: Why do we need this?
A: When working with many projects it's useful to have a dedicated tmux session with three windows per-project: one with a text editor, one for git and one for the build directory. This is why this project was born. However, nested tmux sessions are addictive and quickly become in-terminal workspaces that can be used for any purpose.
-
Q: Does it support multiple nested layers of tmux sessions?
A: Yes.
-
Q: Has it been tested with other configuration X?
A: No.
-
Q: How is this implemented?
A: The idea is two have two configurations,
active-row.confandinactive-row.conf. The former is for the currently active row in the nested tmux tree, the second for the inactive rows. Each session know who its parent is through theTMUX_PARENTenvironment variable (set in thenew-tmuxscript). WhenAlt + Upis pressed, theAlt + F12combination is sent to the active window. If the active window is a nested tmux session, it will loadactive-row.confand forces loadinginactive-row.confin its parent (i.e., the row that originally received theAlt + Upkey combination. WhenAlt + Downis pressed, the current row loadsinactive-row.confand forces loadingactive-row.confin its parent.
