tmux-plugins / tmux-yank

Tmux plugin for copying to system clipboard. Works on OSX, Linux and Cygwin.
https://tmux-plugins.github.io/tmux-yank/
MIT License
2.7k stars 122 forks source link

Copy with double click #156

Open exebixel opened 2 years ago

exebixel commented 2 years ago

HI I recently noticed that if I double click on a word in tmux the word is only copied to tmux primary and not to the clipboard

This is the minimum configuration I'm using

set -g @custom_copy_command 'wl-copy'
set -g @yank_selection_mouse 'clipboard'
set -g @yank_with_mouse on

Is there any option to allow double click to copy to clipboard ?

Shookit commented 2 years ago

I've been badly struggling with this, have you been able to figure out how to get double-click working?

kugel- commented 2 years ago

Same here. Drag and release works but double click not.

lauhub commented 1 year ago

I managed to achieve this under macOS, adding this to ~/.tmux.conf

bind -n DoubleClick1Pane \
    select-pane \; \
    copy-mode -M \; \
    send -X select-word \; \
    run-shell -d 0.1 \; \
    send -X copy-pipe-no-clear "reattach-to-user-namespace pbcopy" \; \
    run-shell -d 0.01 \; \
    send -X cancel

I think you should replace the "reattach-to-user-namespace pbcopy" part with your own copy command. As I am not a tmux-yank guru, I am not sure if you can use directly custom_copy_command, let us know what you wrote there.

Then sourcing the file:

tmux source ~/.tmux.conf