aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/commands.rs
diff options
context:
space:
mode:
Diffstat (limited to 'helix-term/src/commands.rs')
-rw-r--r--helix-term/src/commands.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 9859f64b..116c6378 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -275,6 +275,7 @@ impl MappableCommand {
select_regex, "Select all regex matches inside selections",
split_selection, "Split selections on regex matches",
split_selection_on_newline, "Split selection on newlines",
+ merge_selections, "Merge selections",
merge_consecutive_selections, "Merge consecutive selections",
search, "Search for regex pattern",
rsearch, "Reverse search for regex pattern",
@@ -1737,6 +1738,12 @@ fn split_selection_on_newline(cx: &mut Context) {
doc.set_selection(view.id, selection);
}
+fn merge_selections(cx: &mut Context) {
+ let (view, doc) = current!(cx.editor);
+ let selection = doc.selection(view.id).clone().merge_ranges();
+ doc.set_selection(view.id, selection);
+}
+
fn merge_consecutive_selections(cx: &mut Context) {
let (view, doc) = current!(cx.editor);
let selection = doc.selection(view.id).clone().merge_consecutive_ranges();