aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/keymap.rs
diff options
context:
space:
mode:
authorAntoni Stevenet2021-06-05 00:25:46 +0000
committerGitHub2021-06-05 00:25:46 +0000
commita1f4b8f92b50fbb446400b167b344cdf189978f9 (patch)
treea5e83e878c97e51fe81ae747c86bccf0cce22be3 /helix-term/src/keymap.rs
parent72eaaaac995cf55d37994c24cc0215c8370c6443 (diff)
Add home-end keymaps, (as kakoune/vim do) (#83)
* add home-end keymaps * implement extend methods for extend_line_start, extend_line_end * add home-end mappings to keymaps.md * add ^-$ extend mappings for extend mode * pass cargo linter
Diffstat (limited to 'helix-term/src/keymap.rs')
-rw-r--r--helix-term/src/keymap.rs26
1 files changed, 22 insertions, 4 deletions
diff --git a/helix-term/src/keymap.rs b/helix-term/src/keymap.rs
index b1d8428b..7376cd03 100644
--- a/helix-term/src/keymap.rs
+++ b/helix-term/src/keymap.rs
@@ -61,8 +61,8 @@ use std::collections::HashMap;
// in kakoune these are alt-h alt-l / gh gl
// select from curs to begin end / move curs to begin end
// 0 = start of line
-// ^ = start of line (first non blank char)
-// $ = end of line
+// ^ = start of line(first non blank char) || Home = start of line(first non blank char)
+// $ = end of line || End = end of line
//
// z = save selections
// Z = restore selections
@@ -153,6 +153,16 @@ pub fn default() -> Keymaps {
//
key!('r') => commands::replace,
+ KeyEvent {
+ code: KeyCode::Home,
+ modifiers: KeyModifiers::NONE
+ } => commands::move_line_start,
+
+ KeyEvent {
+ code: KeyCode::End,
+ modifiers: KeyModifiers::NONE
+ } => commands::move_line_end,
+
key!('w') => commands::move_next_word_start,
key!('b') => commands::move_prev_word_start,
key!('e') => commands::move_next_word_end,
@@ -306,13 +316,21 @@ pub fn default() -> Keymaps {
key!('t') => commands::extend_till_char,
key!('f') => commands::extend_next_char,
+
key!('T') => commands::extend_till_prev_char,
key!('F') => commands::extend_prev_char,
-
+ KeyEvent {
+ code: KeyCode::Home,
+ modifiers: KeyModifiers::NONE
+ } => commands::extend_line_start,
+ KeyEvent {
+ code: KeyCode::End,
+ modifiers: KeyModifiers::NONE
+ } => commands::extend_line_end,
KeyEvent {
code: KeyCode::Esc,
modifiers: KeyModifiers::NONE
- } => commands::exit_select_mode as Command,
+ } => commands::exit_select_mode,
)
.into_iter(),
);