feat(extras): added extra for mini.animate. Highly recommended!

This commit is contained in:
Folke Lemaitre
2023-01-23 00:11:22 +01:00
parent d184825ee3
commit 1a55a167a0

View File

@ -0,0 +1,40 @@
return {
-- animations
{
"echasnovski/mini.animate",
event = "VeryLazy",
opts = function()
-- don't use animate when scrolling with the mouse
local mouse_scrolled = false
for _, scroll in ipairs({ "Up", "Down" }) do
local key = "<ScrollWheel" .. scroll .. ">"
vim.keymap.set({ "", "i" }, key, function()
mouse_scrolled = true
return key
end, { expr = true })
end
local animate = require("mini.animate")
return {
resize = {
timing = animate.gen_timing.linear({ duration = 100, unit = "total" }),
},
scroll = {
timing = animate.gen_timing.linear({ duration = 150, unit = "total" }),
subscroll = animate.gen_subscroll.equal({
predicate = function(total_scroll)
if mouse_scrolled then
mouse_scrolled = false
return false
end
return total_scroll > 1
end,
}),
},
}
end,
config = function(_, opts)
require("mini.animate").setup(opts)
end,
},
}