tmux-yank
tmux-yank copied to clipboard
Add new option to control mouse yank_action
Thanks for this plugin <3
This PR adds a new option @yank_action_mouse that acts like the @yank_action option for mouse selections and falls back to said one when not set.
The idea is to allow different behavior when copying via mouse selection or via keyboard e.g. leave the selection in tact after copying to primary clipboard when selecting with the mouse but remove the selection when typing y to copy to the clipboard.
Currently it is only possible to
- either have the selection removed after copying (
copy-pipe), which also removes it when I select with the mouse, which (at least I think) is unintuitive - or always keep the selection (
copy-pipe-no-clear) which behaves differently from what nvim does when pressingy(nvim removes the selection)
To fix this, with the new option one could configure
set -g @yank_selection 'clipboard'
set -g @yank_selection_mouse 'primary'
set -g @yank_action 'copy-selection'
set -g @yank_action_mouse 'pipe-no-clear'
This does the following
- When selecting with the mouse
- the selection is not removed
- the selection is copied to the
primaryclipboard
- When typing
yon a selection- the selection is removed
- the selection is copied to the system
clipboard - the selection is copied to the tmux clipboard buffer
Which is similar to how most GUI copying works with mouse selection and Ctrl+C instead of y (except for the removal of the selection to behave like nvim).