From 80462c29caf2ad138c22404dd6ea1e3501ecb70c Mon Sep 17 00:00:00 2001 From: Gokul Soumya Date: Mon, 6 Sep 2021 17:22:11 +0530 Subject: [PATCH] feat: Sticky view mode with Z --- book/src/keymap.md | 10 +++++++++- helix-term/src/keymap.rs | 16 ++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/book/src/keymap.md b/book/src/keymap.md index 861e46ac727b2..234f83de70cab 100644 --- a/book/src/keymap.md +++ b/book/src/keymap.md @@ -35,6 +35,7 @@ | `m` | Enter [match mode](#match-mode) | N/A | | `:` | Enter command mode | `command_mode` | | `z` | Enter [view mode](#view-mode) | N/A | +| `Z` | Enter sticky [view mode](#view-mode) | N/A | | `Ctrl-w` | Enter [window mode](#window-mode) (maybe will be remove for spc w w later) | N/A | | `Space` | Enter [space mode](#space-mode) | N/A | | `K` | Show documentation for the item under the cursor | `hover` | @@ -144,7 +145,10 @@ commands to extend the existing selection instead of replacing it. ## View mode View mode is intended for scrolling and manipulating the view without changing -the selection. +the selection. The "sticky" variant of this mode is persistent; use the Escape +key to return to normal mode after usage (useful when you're simply looking +over text and not actively editing it). + | Key | Description | Command | | ----- | ----------- | ------- | @@ -154,6 +158,10 @@ the selection. | `m` | Align the line to the middle of the screen (horizontally) | `align_view_middle` | | `j` | Scroll the view downwards | `scroll_down` | | `k` | Scroll the view upwards | `scroll_up` | +| `f` | Move page down | `page_down` | +| `b` | Move page up | `page_up` | +| `d` | Move half page down | `half_page_down` | +| `u` | Move half page up | `half_page_up` | ## Goto mode diff --git a/helix-term/src/keymap.rs b/helix-term/src/keymap.rs index aa60482dffbc2..5b8d2627f6834 100644 --- a/helix-term/src/keymap.rs +++ b/helix-term/src/keymap.rs @@ -563,6 +563,22 @@ impl Default for Keymaps { "m" => align_view_middle, "k" => scroll_up, "j" => scroll_down, + "b" => page_up, + "f" => page_down, + "u" => half_page_up, + "d" => half_page_down, + }, + "Z" => { "View" sticky=true + "z" | "c" => align_view_center, + "t" => align_view_top, + "b" => align_view_bottom, + "m" => align_view_middle, + "k" => scroll_up, + "j" => scroll_down, + "b" => page_up, + "f" => page_down, + "u" => half_page_up, + "d" => half_page_down, }, "\"" => select_register,