on master help sign in
commands: % as select_all.
30d1b70Blaž Hrastnik
helix-term/src/commands.rs+9
@@ -284,6 +284,15 @@ pub fn extend_line_down(cx: &mut Context) {
284 doc.set_selection(selection);
284 doc.set_selection(selection);
285}
285}
286
286
287+pub fn select_all(cx: &mut Context) {
288+ let doc = cx.doc();
289+
290+ doc.set_selection(Selection::single(
291+ 0,
292+ doc.text().len_chars().saturating_sub(1),
293+ ))
294+}
295+
287pub fn select_regex(cx: &mut Context) {
296pub fn select_regex(cx: &mut Context) {
288 let prompt = ui::regex_prompt(cx, "select:".to_string(), |doc, regex| {
297 let prompt = ui::regex_prompt(cx, "select:".to_string(), |doc, regex| {
289 let text = &doc.text().slice(..);
298 let text = &doc.text().slice(..);
helix-term/src/keymap.rs+2−1
@@ -164,7 +164,8 @@ pub fn default() -> Keymaps {
164 vec![shift!('S')] => commands::split_selection,
164 vec![shift!('S')] => commands::split_selection,
165 vec![key!(';')] => commands::collapse_selection,
165 vec![key!(';')] => commands::collapse_selection,
166 // TODO should be alt(;)
166 // TODO should be alt(;)
167+ vec![alt!(';')] => commands::flip_selections,
167− vec![key!('%')] => commands::flip_selections,
168+ vec![key!('%')] => commands::select_all,
168 vec![key!('x')] => commands::select_line,
169 vec![key!('x')] => commands::select_line,
169 vec![key!('u')] => commands::undo,
170 vec![key!('u')] => commands::undo,
170 vec![shift!('U')] => commands::redo,
171 vec![shift!('U')] => commands::redo,