Skip to content

Add new option to control mouse yank_action #186

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

x3rAx
Copy link

@x3rAx x3rAx commented Jun 3, 2025

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 pressing y (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 primary clipboard
  • When typing y on 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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant