]> Sergey Matveev's repositories - dotfiles.git/commitdiff
Autocreate tmux sessions
authorSergey Matveev <stargrave@stargrave.org>
Sat, 18 Sep 2021 08:25:09 +0000 (11:25 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Sat, 18 Sep 2021 08:25:09 +0000 (11:25 +0300)
zsh/.zshrc

index 7284b49f84cc30c388e3ec77b6f8ca3b05ae3e72..36c6de1cc934af8025e36cb7edc5ef3031b4ba09 100644 (file)
@@ -90,7 +90,8 @@ f() {
 alias ssh="TERM=xterm ssh"
 alias sshnm="ssh -S none"
 ssht() {
 alias ssh="TERM=xterm ssh"
 alias sshnm="ssh -S none"
 ssht() {
-    ssh -C -t $1 tmux attach -t0
+    local t="-t 0"
+    TERM=xterm ssh -C -t $1 "tmux has-session $t && tmux attach-session $t || tmux new-session $t"
 }
 
 autoload -U zsh-mime-setup ; zsh-mime-setup
 }
 
 autoload -U zsh-mime-setup ; zsh-mime-setup