cannot scroll back with pageup after upgrade nvim-0.10
after upgrade nvim 0.9.5 -> 0.10 the pagedown is working, but pageup is not working correctly
Are you getting any errors? Is it just the top of the file where pageup isnt working?
just the top of the file where pageup isnt working
yes, but top of file, but top is more than one page
I have the same problem
I was having this issue as well. Realized it's not from the plugin, but my scrolloff option was set too low. To fix, set vim.opt.scrolloff to a minimum of half the window height: vim.api.nvim_win_get_height(0) / 2.
Here's an autocmd to set vim.opt_local.scrolloff on depending on how big your window is:
local set_local_scrolloff_group = vim.api.nvim_create_augroup("set_local_scrolloff", { clear = true })
vim.api.nvim_create_autocmd({ "WinResized" }, {
group = set_local_scrolloff_group,
desc = "Set local scrolloff based on window height",
pattern = { "*" },
callback = function()
local half_win_height = math.ceil(vim.api.nvim_win_get_height(0) / 2)
vim.opt_local.scrolloff = half_win_height
end,
})
Ah found the issue. It wasn't scrolling at the top since fixed window scrolling was enabled for those keymaps.
These keymaps should fix the issue:
vim.keymap.set({ 'n', 'x' }, '<C-b>', "<Cmd>lua Scroll('<C-b>', 0, 1)<CR>")
vim.keymap.set({ 'n', 'x' }, '<C-f>', "<Cmd>lua Scroll('<C-f>', 0, 1)<CR>")
vim.keymap.set({ 'n', 'x' }, '<PageUp>', "<Cmd>lua Scroll('<C-b>', 0, 1)<CR>")
vim.keymap.set({ 'n', 'x' }, '<PageDown>', "<Cmd>lua Scroll('<C-f>', 0, 1)<CR>")
I don't like the animation so I'm going to see if there's an easy way to improve it before I push this change. Any feedback on these is greatly appreciated!