@@ -290,6 +290,7 @@ impl Command {
290 join_selections, "Join lines inside selection",
290 join_selections, "Join lines inside selection",
291 keep_selections, "Keep selections matching regex",
291 keep_selections, "Keep selections matching regex",
292 keep_primary_selection, "Keep primary selection",
292 keep_primary_selection, "Keep primary selection",
293+ remove_primary_selection, "Remove primary selection",
293 completion, "Invoke completion popup",
294 completion, "Invoke completion popup",
294 hover, "Show docs for item under cursor",
295 hover, "Show docs for item under cursor",
295 toggle_comments, "Comment/uncomment selections",
296 toggle_comments, "Comment/uncomment selections",
@@ -4016,11 +4017,27 @@ fn keep_selections(cx: &mut Context) {
4017fn keep_primary_selection(cx: &mut Context) {
4018fn keep_primary_selection(cx: &mut Context) {
4018 let (view, doc) = current!(cx.editor);
4019 let (view, doc) = current!(cx.editor);
4020+ // TODO: handle count
4020 let range = doc.selection(view.id).primary();
4022 let range = doc.selection(view.id).primary();
4021 doc.set_selection(view.id, Selection::single(range.anchor, range.head));
4023 doc.set_selection(view.id, Selection::single(range.anchor, range.head));
4026+fn remove_primary_selection(cx: &mut Context) {
4027+ let (view, doc) = current!(cx.editor);
4028+ // TODO: handle count
4030+ let selection = doc.selection(view.id);
4031+ if selection.len() == 1 {
4032+ cx.editor.set_error("no selections remaining".to_owned());
4035+ let index = selection.primary_index();
4036+ let selection = selection.clone().remove(index);
4038+ doc.set_selection(view.id, selection);
4024fn completion(cx: &mut Context) {
4041fn completion(cx: &mut Context) {
4025 // trigger on trigger char, or if user calls it
4042 // trigger on trigger char, or if user calls it
4026 // (or on word char typing??)
4043 // (or on word char typing??)