aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--book/src/keymap.md2
-rw-r--r--helix-term/src/commands.rs12
-rw-r--r--helix-term/src/keymap/default.rs2
3 files changed, 14 insertions, 2 deletions
diff --git a/book/src/keymap.md b/book/src/keymap.md
index 153f3b64..5dc467f2 100644
--- a/book/src/keymap.md
+++ b/book/src/keymap.md
@@ -291,7 +291,7 @@ This layer is a kludge of mappings, mostly pickers.
| `w` | Enter [window mode](#window-mode) | N/A |
| `p` | Paste system clipboard after selections | `paste_clipboard_after` |
| `P` | Paste system clipboard before selections | `paste_clipboard_before` |
-| `y` | Join and yank selections to clipboard | `yank_joined_to_clipboard` |
+| `y` | Yank selections to clipboard | `yank_to_clipboard` |
| `Y` | Yank main selection to clipboard | `yank_main_selection_to_clipboard` |
| `R` | Replace selections by clipboard contents | `replace_selections_with_clipboard` |
| `/` | Global search in workspace folder | `global_search` |
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 21e2933f..bf60ad71 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -375,6 +375,8 @@ impl MappableCommand {
later, "Move forward in history",
commit_undo_checkpoint, "Commit changes to new checkpoint",
yank, "Yank selection",
+ yank_to_clipboard, "Yank selections to clipboard",
+ yank_to_primary_clipboard, "Yank selections to primary clipboard",
yank_joined, "Join and yank selections",
yank_joined_to_clipboard, "Join and yank selections to clipboard",
yank_main_selection_to_clipboard, "Yank main selection to clipboard",
@@ -3762,6 +3764,16 @@ fn yank(cx: &mut Context) {
exit_select_mode(cx);
}
+fn yank_to_clipboard(cx: &mut Context) {
+ yank_impl(cx.editor, '*');
+ exit_select_mode(cx);
+}
+
+fn yank_to_primary_clipboard(cx: &mut Context) {
+ yank_impl(cx.editor, '+');
+ exit_select_mode(cx);
+}
+
fn yank_impl(editor: &mut Editor, register: char) {
let (view, doc) = current!(editor);
let text = doc.text().slice(..);
diff --git a/helix-term/src/keymap/default.rs b/helix-term/src/keymap/default.rs
index c84c616c..37983352 100644
--- a/helix-term/src/keymap/default.rs
+++ b/helix-term/src/keymap/default.rs
@@ -265,7 +265,7 @@ pub fn default() -> HashMap<Mode, KeyTrie> {
"C-v" | "v" => vsplit_new,
},
},
- "y" => yank_joined_to_clipboard,
+ "y" => yank_to_clipboard,
"Y" => yank_main_selection_to_clipboard,
"p" => paste_clipboard_after,
"P" => paste_clipboard_before,