@@ -376,6 +376,7 @@ impl MappableCommand {
376376 later, "Move forward in history",
377377 commit_undo_checkpoint, "Commit changes to new checkpoint",
378378 yank, "Yank selection",
379+ yank_joined, "Join and yank selections",
379380 yank_joined_to_clipboard, "Join and yank selections to clipboard",
380381 yank_main_selection_to_clipboard, "Yank main selection to clipboard",
381382 yank_joined_to_primary_clipboard, "Join and yank selections to primary clipboard",
@@ -3724,6 +3725,38 @@ fn yank(cx: &mut Context) {
37243725 exit_select_mode(cx);
37253726}
37263727
3728+fn yank_joined_impl(editor: &mut Editor, separator: &str, register: char) {
3729+ let (view, doc) = current!(editor);
3730+ let text = doc.text().slice(..);
3731+
3732+ let selection = doc.selection(view.id);
3733+ let joined = selection
3734+ .fragments(text)
3735+ .fold(String::new(), |mut acc, fragment| {
3736+ if !acc.is_empty() {
3737+ acc.push_str(separator);
3738+ }
3739+ acc.push_str(&fragment);
3740+ acc
3741+ });
3742+
3743+ let msg = format!(
3744+ "joined and yanked {} selection(s) to register {}",
3745+ selection.len(),
3746+ register,
3747+ );
3748+
3749+ editor.registers.write(register, vec![joined]);
3750+ editor.set_status(msg);
3751+}
3752+
3753+fn yank_joined(cx: &mut Context) {
3754+ let line_ending = doc!(cx.editor).line_ending;
3755+ let register = cx.register.unwrap_or('"');
3756+ yank_joined_impl(cx.editor, line_ending.as_str(), register);
3757+ exit_select_mode(cx);
3758+}
3759+
37273760fn yank_joined_to_clipboard_impl(
37283761 editor: &mut Editor,
37293762 separator: &str,