Reputation: 473
Just like leader_key + C creates a new window inside a session. Is there a similar shortcut for creating a new session ? Currently, I use leader_key + new
Upvotes: 15
Views: 19876
Reputation: 1
You can create this keybinding in the .tmux.config
:
bind-key L command-prompt -p "Enter session name:" "new-session -s '%%'"
bind-key C command-prompt -p "Enter window name:" "new-window -n '%%'"
Upvotes: 0
Reputation: 587
Why not just create a keybinding for that in your .tmux.conf
?
These two settings let you create/kill a new session when pressing Prefix S (Shift+s)
or Prefix K (Shift+k)
respectively:
bind S command-prompt -p "New Session:" "new-session -A -s '%%'"
bind K confirm kill-session
Prefix Shift+s
will open a command prompt in the status line, asking for a new session name. It will either create a new session with that name or attach to an already existing session by that name.
Upvotes: 20
Reputation: 226
There are no predefined shortcuts, the only native way to do it is :
Create session: tmux new -s session_name
Ctrl-B + d to detach
Return to your session: tmux attach-session -t session_name
Upvotes: 15