-
Is there an option to center the screen when using Snacks.scroll? Normally I had a the below keymap to do this for vim.keymap.set("n", "<C-d>", "<C-d>zz", desc = "Scroll down")
vim.keymap.set("n", "<C-u>", "<C-u>zz", desc = "Scroll up") I tried adding a scrolloff of 999 to my Snacks.scroll config to force centering, but that didn't seem to have an effect. My normal scrolloff setting is at 8. {
scroll = { enabled = true, scrolloff = 999 },
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
It's not possible for snacks to detect that kind of scrolling unfortunately. You can configure vim.keymap.set("n", "<C-d>", function()
vim.wo.scrolloff = 999
vim.defer_fn(function()
vim.wo.scrolloff = 8
end, 500)
return "<c-d>"
end, { expr = true })
vim.keymap.set("n", "<C-u>", function()
vim.wo.scrolloff = 999
vim.defer_fn(function()
vim.wo.scrolloff = 8
end, 500)
return "<c-u>"
end, { expr = true }) |
Beta Was this translation helpful? Give feedback.
It's not possible for snacks to detect that kind of scrolling unfortunately.
As far as snacks is concerned, that
zz
never happened.You can configure
vim.o.scrolloff = 999
though, or do somthing like the below to just set it for scrolling keymaps: