diff options
author | Caleb Maclennan <caleb@alerque.com> | 2024-02-12 12:31:35 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-12 09:31:35 +0000 |
commit | 8805d04c4beccd030e2e272e0419bb55e1692112 (patch) | |
tree | 275fd9ac29bcc8a75cc30be37357bbfc4515d4e1 | |
parent | b4f8d1433bf6ac28e71969c0a141d53acd93fdf9 (diff) |
feat: Add 'a', 'A', 'h', and 'l' bindings to vim-normal mode (#1697)
The current 'i' binding to switch to insert mode is entirely unintuitive
since what I almost always want to do is append to the current query.
The fact that the cursor extends past the current input (which vim
doesn't do with default settings) adds to the problem. The 'a' key is
what I would reach for, but 'A' makes a lot of sense too so I added
that.
The 'h' and 'l' bindings for moving the cursor also help makes things
a bit more usable.
-rw-r--r-- | atuin/src/command/client/search/interactive.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/atuin/src/command/client/search/interactive.rs b/atuin/src/command/client/search/interactive.rs index 5401a269..7680ce53 100644 --- a/atuin/src/command/client/search/interactive.rs +++ b/atuin/src/command/client/search/interactive.rs @@ -264,6 +264,26 @@ impl State { KeyCode::Char('k') if !ctrl => { return self.handle_search_up(settings, true); } + KeyCode::Char('h') if !ctrl => { + self.search.input.left(); + return InputAction::Continue; + } + KeyCode::Char('l') if !ctrl => { + self.search.input.right(); + return InputAction::Continue; + } + KeyCode::Char('a') if !ctrl => { + self.search.input.right(); + self.set_keymap_cursor(settings, "vim_insert"); + self.keymap_mode = KeymapMode::VimInsert; + return InputAction::Continue; + } + KeyCode::Char('A') if !ctrl => { + self.search.input.end(); + self.set_keymap_cursor(settings, "vim_insert"); + self.keymap_mode = KeymapMode::VimInsert; + return InputAction::Continue; + } KeyCode::Char('i') if !ctrl => { self.set_keymap_cursor(settings, "vim_insert"); self.keymap_mode = KeymapMode::VimInsert; |