summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.zshrc15
1 files changed, 15 insertions, 0 deletions
diff --git a/.zshrc b/.zshrc
index ae50701..1272f85 100644
--- a/.zshrc
+++ b/.zshrc
@@ -147,3 +147,18 @@ alias dotfiles='git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'
export PS1="%m [%n:%c]%# "
+if [ "$(command -v tmux)" ]; then
+ ## == TMUX sessions ==
+ tmux has-session -t main 2>/dev/null
+
+ # Create the session if it doesn't exists.
+ if [[ $? -ne 0 ]]; then
+ TMUX='' tmux new-session -d -s main
+ fi
+
+ if [[ -z "$TMUX" ]]; then
+ tmux attach-session -t main
+ else
+ tmux switch-client -t main
+ fi
+fi