From 8ab681627c05511e0b3d76825911a8b6ce050d4e Mon Sep 17 00:00:00 2001 From: bchanot Date: Tue, 6 Oct 2026 15:13:00 +0200 Subject: [PATCH] fix(tmux): a click in copy-mode returns to the prompt MouseDown1Pane in copy-mode-vi now cancels the mode instead of only clearing the selection. Drag-select (root MouseDrag1Pane re-enters copy-mode) and click-to-switch-pane are unchanged. --- tmux.conf | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tmux.conf b/tmux.conf index b7020d2..5f4cce2 100644 --- a/tmux.conf +++ b/tmux.conf @@ -151,10 +151,12 @@ if-shell 'command -v pbcopy >/dev/null' \ bind-key -Tcopy-mode-vi Escape send -X cancel # cancel v mode bind-key -Tcopy-mode-vi ^v send -X rectangle-toggle # cancel v mode -bind-key -T copy-mode-vi MouseDown1Pane select-pane\; send-keys -X clear-selection +bind-key -T copy-mode-vi MouseDown1Pane select-pane -t = \; send-keys -X cancel bind -n MouseDrag1Pane if -Ft= '#{mouse_any_flag}' 'if -Ft= \"#{pane_in_mode}\" \"copy-mode -eM\" \"send-keys -M\"' 'copy-mode -eM' # (note) {{{ -# The `bind-key -T copy-m...` let a single click do selection clearing for us. +# The `bind-key -T copy-m...` makes a single click leave copy-mode: back to +# the prompt, selection dropped. A drag still selects (MouseDrag1Pane below +# re-enters copy-mode) and a click on another pane still switches to it. # The `bind -n MouseDrag1Pane if -Ft= ...` changes the default binding of # MouseDrag1Pane, the only difference is that we use `copy-mode -eM` instead # of `copy-mode -M`, so that WheelDownPane can trigger copy-mode to exit when