My current workflow is:
- CTRL+SHIFT+T to launch a new terminal window. That starts a new zsh terminal.
tmuxto start tmux.
How can I have tmux load by default with a new terminal window?
There are at least two ways:
Write something like
if [ "$TMUX" = "" ]; then tmux; fi
at the beginning of
~/.zshrc. Note the conditional test to a possible loop when
tmux spawns its own
Modify terminal launching command to something like
xterm -e tmux
I prefer the second way, because sometimes I need to launch a terminal without
tmux (for example when I need to reconnect to an existing session).
Be careful with the
echo tmux >> ~/.zshrc solution though, I remember
that simply throwing a
bash in a
.cshrc file caused me trouble over SSH.
IIRC the problem occurred with non-interactive shells, so you should test for that.
case $- in *i*) if [ -z "$TMUX" ]; then exec tmux; fi;; esac
add it to your
if [ -z "$TMUX" ] then tmux attach -t TMUX || tmux new -s TMUX fi
then tmux will automatically connect to a session called TMUX when you launch your terminal.
Add "tmux" to your .zshrc file, which gets executed every time you start zsh. The quick way:
echo tmux >> ~/.zshrc
Add this in your
if [ -z $TMUX ]; then; tmux; fi
There is actually a default plugin
Add it to your plugins list then set
ZSH_TMUX_AUTOSTART=true in your
For more reference, go here