Skip to content

Commit

Permalink
feat(nvim): add mini.animate plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
RayGuo-ergou committed Apr 17, 2024
1 parent 6cc58c9 commit 3c1853b
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions nvim/lua/ergou/plugins/mini-nvim.lua
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,38 @@ return {
},
},
},
{
'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,
},
}

0 comments on commit 3c1853b

Please sign in to comment.