1
0
Fork 0
mirror of https://github.com/helix-editor/helix synced 2024-05-21 04:06:06 +02:00

Collapse cursors command (;).

This commit is contained in:
Blaž Hrastnik 2020-10-01 18:44:46 +09:00
parent 5945815d97
commit 77d75d9275
2 changed files with 8 additions and 0 deletions

View File

@ -168,6 +168,13 @@ pub fn change_selection(view: &mut View, count: usize) {
insert_mode(view, count);
}
pub fn collapse_selection(view: &mut View, _count: usize) {
view.state.selection = view
.state
.selection
.transform(|range| Range::new(range.head, range.head))
}
// insert mode:
// first we calculate the correct cursors/selections
// then we just append at each cursor

View File

@ -134,6 +134,7 @@ pub fn default() -> Keymaps {
vec![key!('d')] => commands::delete_selection,
vec![key!('c')] => commands::change_selection,
vec![key!('s')] => commands::split_selection_on_newline,
vec![key!(';')] => commands::collapse_selection,
vec![Key {
code: KeyCode::Esc,
modifiers: Modifiers::NONE