浏览代码

shrc: tx: use switch-client if already in tmux session

pull/1/head
10sr 10 年前
父节点
当前提交
3105222977
共有 1 个文件被更改,包括 9 次插入6 次删除
  1. +9
    -6
      shrc

+ 9
- 6
shrc 查看文件

@@ -665,15 +665,18 @@ __realpath(){

tx(){
tmux start-server
if test $# -eq 0
if test -z "$1"
then
echo ":: tx <session> to attach."
tmux ls
elif tmux has -t "$1"
echo "usage: tx <session_name>"
tmux list-sessions
elif test -z "$TMUX"
then
tmux attach -t "$1"
# -A: attach if already exists
tmux new-session -A -c "$HOME" -s "$1"
else
tmux new -s "$1"
# create new session if not exists yet
tmux has-session -t "$1" || TMUX= tmux new-session -d -c "$HOME" -s "$1"
tmux switch-client -t "$1"
fi
}



正在加载...
取消
保存