-
Notifications
You must be signed in to change notification settings - Fork 344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ability to seek in the main pane #1327
Comments
What if the cursor is scrolled to the edge of the page? In that case, doesn't the cursor have to be moved anyway? |
Yes exactly, the expected behavior is similar to vim's ctrl+e and ctrl+y. |
Something to mention though, it would be nice if the scroll unit is in number of cells and not in terms of the available window space. |
I wrote a plugin for it, which basically moves the cursor to the edge of the list to make the list scroll, and then restores the cursor to its original position. Save it as return {
entry = function(_, args)
local folder = cx.active.current
local total = #folder.files - 1
if total <= 0 then
return
end
local step = tonumber(args[1])
local start = folder.window[1].idx - 1 + MANAGER.scrolloff
local end_ = folder.window[#folder.window].idx - 1 - MANAGER.scrolloff
local bound
if step > 0 then
bound = { math.min(total, start + step), math.min(total, end_ + step) }
else
bound = { math.max(0, start + step), math.max(0, end_ + step) }
end
local target = step > 0 and bound[2] or bound[1]
local delta = target - folder.cursor
for _ = 1, math.abs(delta) do
ya.manager_emit("arrow", { delta > 0 and 1 or -1 })
end
ya.manager_emit("arrow", {
ya.clamp(bound[1], folder.cursor, bound[2]) - target,
})
end,
} And bind these keys to it: { on = "<C-j>", run = 'plugin --sync list-seek --args="5"' },
{ on = "<C-k>", run = 'plugin --sync list-seek --args="-5"' }, This plugin also handles screenshot-002046.mp4 |
Please describe the problem you're trying to solve
Most of the file managers has an option to scroll the main pane. By scroll I mean the cursor doesn't move while the pane itself scrolls up/down. It would be really nice If yazi introduces these features for the main panes.
This option in available for the preview pane which is "seek [n]". However it seems that n can't be set to a number below 5 (Maybe this is related to scrolloff? Although I did set scrolloff = 0 and still n can't get below 5) and setting it below 5 has no effect and the seek value is still 5. I opened a separate issue for this please check it out.
Thanks a lot in advance!
Would you be willing to contribute this feature?
Describe the solution you'd like
Described earlier, for any further clarification please do let me know.
Additional context
No response
The text was updated successfully, but these errors were encountered: