gpakosz / .tmux

🇫🇷 Oh my tmux! My self-contained, pretty & versatile tmux configuration made with ❤️
MIT License
21.97k stars 3.37k forks source link

Feature request: add option to allow xclip -selection [pimary/secondary/clipboard] to be configured from .tmux.conf.local #349

Open kting28 opened 4 years ago

kting28 commented 4 years ago

Hello, thanks for the wonderful tmux configurations! The only thing I really want is to able to configure the destination of xclip / xsel so that in linux user can use the middle mouse button to paste. By default the "clipboard" selection requires ctrl-v from GUI applications.

As a workaround I'm just rebinding them in user configuration, e.g.:

bind-key    -T copy-mode-vi Enter                send-keys -X copy-pipe-and-cancel "xclip -i -selection primary > /dev/null 2>&1"
bind-key    -T copy-mode-vi y                    send-keys -X copy-pipe-and-cancel "xclip -i -selection primary > /dev/null 2>&1"
bind-key    -T copy-mode-vi MouseDragEnd1Pane    send-keys -X copy-pipe-and-cancel "xclip -i -selection primary > /dev/null 2>&1"
gpakosz commented 4 years ago

Hello @kting28 👋

If I understand correctly, you prefer to use XA_PRIMARY, i.e. pasting with the middle mouse button.

However in the bindings you gave above you're didn't change the binding for copy-mode-vi -y. Is it ton purpose?

kting28 commented 4 years ago

Oh thanks for the catch, it's a typo. I have updated the original snippet with what I have now. Basically explicitly use "-selection primary". Ideally we can have a user controlled switch (primary/secondary/clipboard) and that can be used to update all the bindings. However I looked at how the current .tmux.conf is implemented and don't see a good clean way to do it. Hence asking here. Btw, I gave up tmux multiple times before due to difficulty in configuring it and also the mouse-copy behavior. oh-my-tmux really helped me transition from screen and boost my productivity. Thanks again.

gpakosz commented 4 years ago

I'm in the middle of many refactorings but I guess I can make the following happen

tmux_conf_copy_to_os_clipboard=true|false|primary|clipboard

Not sure when I'm ready to do it though

kting28 commented 4 years ago

Awesome!

johnyoonh commented 4 years ago

Another workaround is using yank plugin: https://github.com/tmux-plugins/tmux-yank