diff options
| author | Paul Buetow <paul@buetow.org> | 2026-07-18 20:38:51 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-07-18 20:38:51 +0300 |
| commit | 876ad3e3b8db7a554602b535cf16703409fdc6bb (patch) | |
| tree | fe0ea810aab315c48c23d248693f7f70a92197a0 | |
| parent | 5af64c1c60a00beffdd96a32f93889e71af44b6c (diff) | |
tmux: add Prefix+X to kill current session and attach to next
Bind Prefix+X to capture the current session name, switch the client to
the next available session (switch-client -n), then kill the old session.
Switching before killing keeps the client attached instead of detaching
it. Placed next to the other session-management bindings and commented
with the ordering rationale.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
| -rw-r--r-- | tmux/tmux.conf | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tmux/tmux.conf b/tmux/tmux.conf index 8d3222c..6a40dfe 100644 --- a/tmux/tmux.conf +++ b/tmux/tmux.conf @@ -43,6 +43,14 @@ bind-key @ run-shell 'cur=$(tmux display-message -p "#S"); case "$cur" in A-*) t bind-key O run-shell 'tmux-cycle-a-session next' bind-key I run-shell 'tmux-cycle-a-session prev' +# Kill the current session and attach the client to the next available one. +# Order matters: capture the current name first, hop to the next session with +# switch-client -n, THEN kill the old session. Switching before killing keeps +# the client attached instead of detaching it (killing the session a client is +# on would otherwise drop you back to the shell). If this is the last session, +# switch-client -n is a no-op and killing it detaches the client, as expected. +bind-key X run-shell 'cur=$(tmux display-message -p "#S"); tmux switch-client -n; tmux kill-session -t "$cur"' + set-option -g pane-active-border-style fg=magenta,bold set -g status-right '#{@hexai_status} #[fg=colour8]| %H:%M' |
