Smooth scrolling for Neovim.
Properly handles scrolloff
and mouse scrolling.
Similar plugins:
-- lazy.nvim
{
"folke/snacks.nvim",
opts = {
scroll = {
-- your scroll configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
}
}
}
---@class snacks.scroll.Config
---@field animate snacks.animate.Config
{
animate = {
duration = { step = 15, total = 250 },
easing = "linear",
},
-- what buffers to animate
filter = function(buf)
return vim.g.snacks_scroll ~= false and vim.b[buf].snacks_scroll ~= false and vim.bo[buf].buftype ~= "terminal"
end,
}
---@alias snacks.scroll.View {topline:number, lnum:number}
---@class snacks.scroll.State
---@field anim? snacks.animate.Animation
---@field win number
---@field buf number
---@field view vim.fn.winsaveview.ret
---@field current vim.fn.winsaveview.ret
---@field target vim.fn.winsaveview.ret
---@field scrolloff number
---@field virtualedit? string
Snacks.scroll.disable()
Snacks.scroll.enable()