Create new tmux session from inside a tmux session

前端 未结 6 770
挽巷
挽巷 2021-01-29 20:02

I\'m writing a shell script that creates / attaches or switches to a given session, depending on whether one is inside tmux and the session exists.

I\'ve got everything

6条回答
  •  無奈伤痛
    2021-01-29 20:34

    at user2354696's advice I use following key bindings to create a new session or "clone" an existing session

    bind-key N run-shell 'TMUX= tmux new-session -d \; switch-client -n'
    bind-key C run-shell 'TMUX= tmux new-session -t $(tmux display-message -p #S) -s $(tmux display-message -p #S-clone) -d \; switch-client -n \; display-message "session #S cloned"'
    

提交回复
热议问题