From 38f77bf614d4b0580bc9dc7ff6f16bc5c5ac8562 Mon Sep 17 00:00:00 2001 From: Shafkath Shuhan Date: Sat, 10 Sep 2022 12:38:58 -0400 Subject: [PATCH] add C-y to yank picker selection to clipboard --- helix-term/src/ui/picker.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs index 24d3b2888ba9..fd9851eaecc4 100644 --- a/helix-term/src/ui/picker.rs +++ b/helix-term/src/ui/picker.rs @@ -556,6 +556,22 @@ impl Component for Picker { ctrl!('t') => { self.toggle_preview(); } + ctrl!('y') => { + if let Some(contents) = self.selection() { + let contents = contents.sort_text(&self.editor_data).to_string(); + if let Err(e) = cx + .editor + .clipboard_provider + .set_contents(contents, helix_view::clipboard::ClipboardType::Clipboard) + { + cx.editor + .set_status(format!("Couldn't set system clipboard content: {}", e)) + } else { + cx.editor + .set_status("yanked picker selection to system clipboard"); + } + } + } _ => { self.prompt_handle_event(event, cx); }