Creating a "kill current session" shortcut in Tmux

After playing around I found that I can make following shorcut which behaves the way I want:

  • Kills current session
  • Leaves all other sessions intact

bind X confirm-before "kill-session -t ''"

This solution seems to work but also looks like a hack. I hope there is a better way to do this.

EDIT

As pointed out in the comments, omitting the -t parameter will cause tmux to automatically use the current session so the code could also be shortened to:

bind X confirm-before kill-session

Tags:

Tmux