aboutsummaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-02-09 06:39:26 +0000
committerBlaž Hrastnik2021-02-09 06:39:26 +0000
commit30d1b7098f023ea1cf728e6b989599de364f58ab (patch)
tree8b7af2f9f65e5aa516eb2451db544306b398ecbe /helix-term
parentf2c2fa0cad2a0d15e349765d28e488f9acf88b88 (diff)
commands: % as select_all.
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/commands.rs9
-rw-r--r--helix-term/src/keymap.rs3
2 files changed, 11 insertions, 1 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 9bd6bb8f..3111900d 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -284,6 +284,15 @@ pub fn extend_line_down(cx: &mut Context) {
doc.set_selection(selection);
}
+pub fn select_all(cx: &mut Context) {
+ let doc = cx.doc();
+
+ doc.set_selection(Selection::single(
+ 0,
+ doc.text().len_chars().saturating_sub(1),
+ ))
+}
+
pub fn select_regex(cx: &mut Context) {
let prompt = ui::regex_prompt(cx, "select:".to_string(), |doc, regex| {
let text = &doc.text().slice(..);
diff --git a/helix-term/src/keymap.rs b/helix-term/src/keymap.rs
index efc72b60..69c71d23 100644
--- a/helix-term/src/keymap.rs
+++ b/helix-term/src/keymap.rs
@@ -164,7 +164,8 @@ pub fn default() -> Keymaps {
vec![shift!('S')] => commands::split_selection,
vec![key!(';')] => commands::collapse_selection,
// TODO should be alt(;)
- vec![key!('%')] => commands::flip_selections,
+ vec![alt!(';')] => commands::flip_selections,
+ vec![key!('%')] => commands::select_all,
vec![key!('x')] => commands::select_line,
vec![key!('u')] => commands::undo,
vec![shift!('U')] => commands::redo,