Skip to content

Commit

Permalink
feat: Sticky view mode with Z
Browse files Browse the repository at this point in the history
  • Loading branch information
sudormrfbin committed Sep 10, 2021
1 parent fe17b99 commit 80462c2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
10 changes: 9 additions & 1 deletion book/src/keymap.md
Original file line number Diff line number Diff line change
Expand Up @@ -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` |
Expand Down Expand Up @@ -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 |
| ----- | ----------- | ------- |
Expand All @@ -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

Expand Down
16 changes: 16 additions & 0 deletions helix-term/src/keymap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 80462c2

Please sign in to comment.