From 9d0631e8584106912a81ea95d77c6cbd05d1d0d5 Mon Sep 17 00:00:00 2001 From: Julian Prein Date: Mon, 26 Aug 2024 12:08:18 +0200 Subject: [PATCH] tmux: Copy multi-click selection into primary Also split the MouseDragEnd1Pane binding so that the full xclip arguments can be written out to stay consistent. --- .config/tmux/tmux.conf | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf index e3ead31..aa8889b 100644 --- a/.config/tmux/tmux.conf +++ b/.config/tmux/tmux.conf @@ -22,13 +22,23 @@ set -g prefix C-a bind C-a send-prefix # Copy selection into primary selection (without aborting) -bind -T copy-mode-vi MouseDragEnd1Pane send -X copy-pipe-no-clear "xclip -se p" +bind -T copy-mode-vi MouseDragEnd1Pane { + send -X copy-pipe-no-clear "xclip -selection primary" +} # Select word or line on double or triple click respectively (w/o aborting). # (These are the defaults w/o the `run -d 0.3; send -X copy-pipe-and-cancel`) -bind -T copy-mode-vi SecondClick1Pane select-pane -t= \; send -X select-word -bind -T copy-mode-vi TripleClick1Pane select-pane -t= \; send -X select-line -bind -n DoubleClick1Pane { +bind -T copy-mode-vi SecondClick1Pane { + select-pane -t= + send -X select-word + send -X pipe-no-clear "xclip -selection primary" +} +bind -T copy-mode-vi TripleClick1Pane { + select-pane -t= + send -X select-line + send -X pipe-no-clear "xclip -selection primary" +} +bind -n SecondClick1Pane { select-pane -t= if -F "#{||:#{pane_in_mode},#{mouse_any_flag}}" { send -M @@ -36,6 +46,7 @@ bind -n DoubleClick1Pane { copy-mode send -X select-word } + send -X pipe-no-clear "xclip -selection primary" } bind -n TripleClick1Pane { select-pane -t= @@ -45,6 +56,7 @@ bind -n TripleClick1Pane { copy-mode send -X select-line } + send -X pipe-no-clear "xclip -selection primary" } # Scroll up 5 lines when entering copy-mode through the mouse wheel, send 5x`up`