mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-23 01:46:18 +04:00
Add command for keeping only the primary selection.
This commit is contained in:
parent
dd91090a1a
commit
eea339545c
@ -1167,6 +1167,14 @@ pub fn keep_selections(cx: &mut Context) {
|
||||
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) {
|
||||
|
@ -209,6 +209,9 @@ pub fn default() -> Keymaps {
|
||||
shift!('J') => commands::join_selections,
|
||||
// TODO: conflicts hover/doc
|
||||
shift!('K') => commands::keep_selections,
|
||||
// TODO: and another method for inverse
|
||||
|
||||
key!(' ') => commands::keep_primary_selection,
|
||||
|
||||
// key!('q') => commands::record_macro,
|
||||
// key!('Q') => commands::replay_macro,
|
||||
|
Loading…
Reference in New Issue
Block a user