Add command for keeping only the primary selection.

pull/8/head
Blaž Hrastnik 4 years ago
parent dd91090a1a
commit eea339545c

@ -1167,6 +1167,14 @@ pub fn keep_selections(cx: &mut Context) {
cx.push_layer(Box::new(prompt)); cx.push_layer(Box::new(prompt));
} }
pub fn keep_primary_selection(cx: &mut Context) {
let doc = cx.doc();
let range = doc.selection().primary();
let selection = Selection::single(range.anchor, range.head);
doc.set_selection(selection);
}
// //
pub fn save(cx: &mut Context) { pub fn save(cx: &mut Context) {

@ -209,6 +209,9 @@ pub fn default() -> Keymaps {
shift!('J') => commands::join_selections, shift!('J') => commands::join_selections,
// TODO: conflicts hover/doc // TODO: conflicts hover/doc
shift!('K') => commands::keep_selections, shift!('K') => commands::keep_selections,
// TODO: and another method for inverse
key!(' ') => commands::keep_primary_selection,
// key!('q') => commands::record_macro, // key!('q') => commands::record_macro,
// key!('Q') => commands::replay_macro, // key!('Q') => commands::replay_macro,

Loading…
Cancel
Save