Can I use double click to select and copy in tmux?

In Alacrity holding Shift allows copying as if there's no tmux.

source


Don't know about iterm2, but this can be made to work in tmux 3.0 or newer
(tested on Linux w/ tmux 3.0, last command uses X11 xclip).

Added triple click to select and copy a line too.

# Double LMB Select & Copy (Word)
bind-key -T copy-mode-vi DoubleClick1Pane \
    select-pane \; \
    send-keys -X select-word-no-clear \; \
    send-keys -X copy-pipe-no-clear "xclip -in -sel primary"
bind-key -n DoubleClick1Pane \
    select-pane \; \
    copy-mode -M \; \
    send-keys -X select-word \; \
    send-keys -X copy-pipe-no-clear "xclip -in -sel primary"

# Triple LMB Select & Copy (Line)
bind-key -T copy-mode-vi TripleClick1Pane \
    select-pane \; \
    send-keys -X select-line \; \
    send-keys -X copy-pipe-no-clear "xclip -in -sel primary"
bind-key -n TripleClick1Pane \
    select-pane \; \
    copy-mode -M \; \
    send-keys -X select-line \; \
    send-keys -X copy-pipe-no-clear "xclip -in -sel primary"

If you don't use copy-mode-vi, replace this with copy-mode.


For older tmux versions check the edit-history.


I found a way to achieve that: hold the option key when double clicking.

Tags:

Tmux