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 6, 2021
1 parent fe17b99 commit b95bd8c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
17 changes: 17 additions & 0 deletions 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](#sticky-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 @@ -155,6 +156,22 @@ the selection.
| `j` | Scroll the view downwards | `scroll_down` |
| `k` | Scroll the view upwards | `scroll_up` |

## Sticky view mode

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 |
| --- | --- | --- |
| `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` |
| `g` | Go to the start of the file | `goto_file_start` |
| `e` | Go to the end of the file | `goto_last_line` |

## Goto mode

Jumps to various locations.
Expand Down
10 changes: 10 additions & 0 deletions helix-term/src/keymap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,16 @@ impl Default for Keymaps {
"k" => scroll_up,
"j" => scroll_down,
},
"Z" => { "View" sticky=true
"j" => scroll_down,
"k" => scroll_up,
"f" => page_down,
"b" => page_up,
"d" => half_page_down,
"u" => half_page_up,
"g" => goto_file_start,
"e" => goto_last_line,
},

"\"" => select_register,
"|" => shell_pipe,
Expand Down

0 comments on commit b95bd8c

Please sign in to comment.