-
Notifications
You must be signed in to change notification settings - Fork 36
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
Centering after animation #65
Comments
i also tried the same thing with no luck 😢 |
this is working for me: require("neoscroll").setup({
post_hook = function(info)
vim.cmd("normal! zz")
end,
}) I have a feeling that there's a way to use EDIT: the behavior still isn't really ideal -- it's exactly what I want for |
Spent a few hours on this -- I'd recommend tweaking the specific numbers / easing function: local neoscroll = require("neoscroll")
local easing = "sine"
local zz_time_ms = 100
local jump_time_ms = 200
neoscroll.setup({
post_hook = function(info)
if info ~= "center" then
return
end
-- The `defer_fn` is a bit of a hack.
-- We use it so that `neoscroll.init.scroll` will be false when we call `neoscroll.zz`
-- As long as we don't input another neoscroll mapping in the timeout,
-- we should be able to center the cursor.
local defer_time_ms = 10
vim.defer_fn(function()
neoscroll.zz(zz_time_ms, easing)
end, defer_time_ms)
end,
})
local mappings = {}
mappings["<C-u>"] = { "scroll", { "-vim.wo.scroll", "true", jump_time_ms, easing, "'center'" } }
mappings["<C-d>"] = { "scroll", { "vim.wo.scroll", "true", jump_time_ms, easing, "'center'" } }
require("neoscroll.config").set_mappings(mappings) |
@zdog234 Thank you for creating this hack, it works with your config, but the scroll speed is too fast for my eyes. I've tried to tweak the number but the following happens: cute-xgRkt_2.mp4Basically it'd start to center with |
Hi. Firstly thx for the excellent plugin. I would like to center my screen after every animation. Based on the docs, I figured this would do the trick:
but it doesn't seem to work. I also tried
exe "normal zz"
instead ☁️The text was updated successfully, but these errors were encountered: