on master help sign in
Collapse cursors command (;).
77d75d9Blaž Hrastnik
helix-view/src/commands.rs+7
@@ -168,6 +168,13 @@ pub fn change_selection(view: &mut View, count: usize) {
168 insert_mode(view, count);
168 insert_mode(view, count);
169}
169}
170
170
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+
171// insert mode:
178// insert mode:
172// first we calculate the correct cursors/selections
179// first we calculate the correct cursors/selections
173// then we just append at each cursor
180// then we just append at each cursor
helix-view/src/keymap.rs+1
@@ -134,6 +134,7 @@ pub fn default() -> Keymaps {
134 vec![key!('d')] => commands::delete_selection,
134 vec![key!('d')] => commands::delete_selection,
135 vec![key!('c')] => commands::change_selection,
135 vec![key!('c')] => commands::change_selection,
136 vec![key!('s')] => commands::split_selection_on_newline,
136 vec![key!('s')] => commands::split_selection_on_newline,
137+ vec![key!(';')] => commands::collapse_selection,
137 vec![Key {
138 vec![Key {
138 code: KeyCode::Esc,
139 code: KeyCode::Esc,
139 modifiers: Modifiers::NONE
140 modifiers: Modifiers::NONE