diff options
author | Tyler Davis <tydavis@gmail.com> | 2022-05-21 02:59:36 +0000 |
---|---|---|
committer | Tyler Davis <tydavis@gmail.com> | 2022-05-21 02:59:36 +0000 |
commit | b2a69a00798034ebae4fed8b501f2274f4a9810a (patch) | |
tree | d46f31b6d6efcba1729e27ec591f37e822e7b842 /.zshrc | |
parent | 4ba5d6d99eef47c14ee481f895b120d025327115 (diff) | |
download | dotfiles-b2a69a00798034ebae4fed8b501f2274f4a9810a.tar.gz dotfiles-b2a69a00798034ebae4fed8b501f2274f4a9810a.zip |
zsh: add automatic tmux session
Diffstat (limited to '.zshrc')
-rw-r--r-- | .zshrc | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -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 |