Support moving arrow relative to window, similar to H/M/L vim motions#3970
Open
SpiritCroc wants to merge 2 commits into
Open
Support moving arrow relative to window, similar to H/M/L vim motions#3970SpiritCroc wants to merge 2 commits into
SpiritCroc wants to merge 2 commits into
Conversation
Introduce a new PercentWindow step type, that allows you to move the
cursor to relative position based on the items currently rendered on
screen, similar as H/M/L ("high", "middle", "low") would do in vim.
Not added to default keybinding config since there are some conflicts,
but you can put following to override:
```
{ on = "<S-H>", run = "arrow 0%-window", desc = "High: Move cursor to visible window top without scrolling" },
{ on = "<S-M>", run = "arrow 50%-window", desc = "Middle: Move cursor to visible window center" },
{ on = "<S-L>", run = "arrow 100%-window", desc = "Low: Move cursor to visible window bottom without scrolling" },
```
sxyazi
reviewed
May 17, 2026
Owner
|
This implementation looks wrong as it doesn't respect
Here's how Neovim behaves for JtAlVouL.mp4The same behavior can be reproduced in Vim too. |
Author
|
Ohhhh that makes sense, I never used scrolloff on (neo)vim, so it was off-putting for me and I worked around it for this change, sounds like I can simplify the patch then 👍 |
Author
|
Hope I got the behaviour correct now. |
00e4151 to
7a51626
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduce a new
PercentWindowstep type, that allows you to move the cursor to relative position based on the items currently rendered on screen, similar as H/M/L ("high", "middle", "low") would do in vim.Not added to default keybinding config since there are some conflicts, but you can put following to override:
Which issue does this PR resolve?
#3969
Rationale of this PR
I got used to moving my cursor with "H"/"M"/"L" key bindings in applications supporting vim like motions. Since switching to yazi recently it has been constantly tripping me, that it is not possible to do.
AI disclaimer
I did use AI to write this for me. This means while I did read the code, question some AI decisions and iterated on them, and of course tested this myself, it's fair to point out I'm not an expert in this codebase.