feat: mini.animate
This commit is contained in:
parent
d06e94083b
commit
f8970ebdcc
4 changed files with 59 additions and 0 deletions
|
@ -45,6 +45,7 @@ with final.pkgs.lib; let
|
|||
lualine-nvim
|
||||
noice-nvim
|
||||
indent-blankline-nvim
|
||||
mini-animate
|
||||
|
||||
# Editor
|
||||
neo-tree-nvim
|
||||
|
|
|
@ -5,6 +5,7 @@ return {
|
|||
req('bufferline-nvim'),
|
||||
req('indent-blankline-nvim'),
|
||||
req('lualine-nvim'),
|
||||
req('mini-animate'),
|
||||
req('mini-icons'),
|
||||
req('noice-nvim'),
|
||||
}
|
||||
|
|
56
nvim/lua/plugins/ui/mini-animate.lua
Normal file
56
nvim/lua/plugins/ui/mini-animate.lua
Normal file
|
@ -0,0 +1,56 @@
|
|||
return {
|
||||
'mini.animate',
|
||||
enabled = vim.g.neovide == nil,
|
||||
event = { 'DeferredUIEnter' },
|
||||
after = function()
|
||||
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
|
||||
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
pattern = 'grug-far',
|
||||
callback = function()
|
||||
vim.b.minianimate_disable = true
|
||||
end,
|
||||
})
|
||||
|
||||
Snacks.toggle({
|
||||
name = 'mini animate',
|
||||
get = function()
|
||||
return not vim.g.minianimate_disable
|
||||
end,
|
||||
set = function(state)
|
||||
vim.g.minianimate_disable = not state
|
||||
end,
|
||||
}):map('<LEADER>ua')
|
||||
|
||||
local animate = require('mini.animate')
|
||||
|
||||
local opts = {
|
||||
resize = {
|
||||
timing = animate.gen_timing.linear({ duration = 50, unit = 'total' }),
|
||||
},
|
||||
scroll = {
|
||||
timing = animate.gen_timing.linear({ duration = 50, 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,
|
||||
}),
|
||||
},
|
||||
}
|
||||
|
||||
animate.setup(opts)
|
||||
end,
|
||||
}
|
|
@ -7,6 +7,7 @@ require('snacks').setup({
|
|||
quickfile = { enabled = true },
|
||||
statuscolumn = { enabled = true },
|
||||
words = { enabled = true },
|
||||
scroll = { enabled = false },
|
||||
})
|
||||
|
||||
-- Debuggers -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
||||
|
|
Loading…
Reference in a new issue