Collapse cursors command (;).

pull/2/head
Blaž Hrastnik 4 years ago
parent 5945815d97
commit 77d75d9275

@ -168,6 +168,13 @@ pub fn change_selection(view: &mut View, count: usize) {
insert_mode(view, count); 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: // insert mode:
// first we calculate the correct cursors/selections // first we calculate the correct cursors/selections
// then we just append at each cursor // then we just append at each cursor

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

Loading…
Cancel
Save