Collapse cursors command (;).
commit77d75d92752835e2953b4a70f7ee8a9aeaff9fa0
authorBlaž Hrastnik <blaz@mxxn.io>
dateThu 1 Oct 2020, 18:44 (6 years ago)
parent5945815
helix-view/src/commands.rs+7
@@ -168,6 +168,13 @@ pub fn change_selection(view: &mut View, count: usize) {
168168 insert_mode(view, count);
169169}
170170
171+pub fn collapse_selection(view: &mut View, _count: usize) {
172+ view.state.selection = view
173+ .state
174+ .selection
175+ .transform(|range| Range::new(range.head, range.head))
176+}
177+
171178// insert mode:
172179// first we calculate the correct cursors/selections
173180// then we just append at each cursor
helix-view/src/keymap.rs+1
@@ -134,6 +134,7 @@ pub fn default() -> Keymaps {
134134 vec![key!('d')] => commands::delete_selection,
135135 vec![key!('c')] => commands::change_selection,
136136 vec![key!('s')] => commands::split_selection_on_newline,
137+ vec![key!(';')] => commands::collapse_selection,
137138 vec![Key {
138139 code: KeyCode::Esc,
139140 modifiers: Modifiers::NONE