Skip to content
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

Configure register used for mouse yank #11414

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

Conversation

k2d222
Copy link
Contributor

@k2d222 k2d222 commented Aug 3, 2024

supersedes #7190

I took the liberty to revive this previous PR since I needed this feature.
I implemented the suggestion by @the-mikedavis to allow configuring any register (not just primary/system).

Adds mouse_yank_clipboard configuration option under the
editor section:

[editor]
mouse-yank-clipboard = "system" / "primary" (default "primary")

This affects the following actions:
- Selecting text with mouse will yank to configured clipboard
- Pasting with middle mouse button will use configured clipboard
- Replacing selected text with ALT+middle mouse button will use
  configured clipboard

Without this option Helix will fallback to current behavior of using
the primary clipboard for the above mentioned actions.
@@ -4174,7 +4174,7 @@ fn yank_joined_to_primary_clipboard(cx: &mut Context) {
exit_select_mode(cx);
}

fn yank_primary_selection_impl(editor: &mut Editor, register: char) {
pub(crate) fn yank_main_selection_to_register(editor: &mut Editor, register: char) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if exposing these functions is the right way to do it

@kirawi kirawi added the A-helix-term Area: Helix term improvements label Aug 4, 2024
@k2d222 k2d222 marked this pull request as ready for review August 23, 2024 11:46
@k2d222
Copy link
Contributor Author

k2d222 commented Sep 11, 2024

Forgot about this PR, I believe it is ready for review/merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants