Skip to content

Commit 30cf206

Browse files
feat: scrolling animations
1 parent 355a552 commit 30cf206

File tree

2 files changed

+75
-4
lines changed

2 files changed

+75
-4
lines changed

lazy-lock.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,17 @@
1111
"gitsigns.nvim": { "branch": "main", "commit": "20ad4419564d6e22b189f6738116b38871082332" },
1212
"guess-indent.nvim": { "branch": "main", "commit": "84a4987ff36798c2fc1169cbaff67960aed9776f" },
1313
"lazy.nvim": { "branch": "main", "commit": "f0f5bbb9e5bfae5e6468f9359ffea3d151418176" },
14-
"lazydev.nvim": { "branch": "main", "commit": "371cd7434cbf95606f1969c2c744da31b77fcfa6" },
15-
"mason-lspconfig.nvim": { "branch": "main", "commit": "d7b5feb6e769e995f7fcf44d92f49f811c51d10c" },
14+
"lazydev.nvim": { "branch": "main", "commit": "faf46237f0df43a29e12abd143ff1a0bbac27b7e" },
15+
"mason-lspconfig.nvim": { "branch": "main", "commit": "3590d66effccc7376d8c3dbe45e8291f9fed2843" },
1616
"mason-tool-installer.nvim": { "branch": "main", "commit": "517ef5994ef9d6b738322664d5fdd948f0fdeb46" },
1717
"mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" },
18-
"mini.nvim": { "branch": "main", "commit": "e96ef335c7c68d2bc6359cdb7cf0941889df9be0" },
18+
"mini.animate": { "branch": "main", "commit": "8ce6df739aa9d14c876bace722af28c3d09e9971" },
19+
"mini.nvim": { "branch": "main", "commit": "ee4a4a4abed25e3d108d985b0553c5271f2f71aa" },
1920
"neo-tree.nvim": { "branch": "main", "commit": "8cdd6b1940f333c1dd085526a9c45b30fb2dbf50" },
2021
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
2122
"nvim-dap": { "branch": "master", "commit": "6782b097af2417a4c3e33849b0a26ae2188bd7ea" },
2223
"nvim-dap-ui": { "branch": "master", "commit": "cf91d5e2d07c72903d052f5207511bf7ecdb7122" },
23-
"nvim-lspconfig": { "branch": "master", "commit": "e25994a1c2373784364852cd904cb39b6d75f227" },
24+
"nvim-lspconfig": { "branch": "master", "commit": "c8c9420b7676caf14e1e1d96caed204a81ba860f" },
2425
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
2526
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
2627
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },

lua/custom/plugins/init.lua

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,76 @@ return {
106106
end,
107107
},
108108

109+
-- ========================================================================
110+
-- SMOOTH SCROLLING & ANIMATIONS - mini.animate
111+
-- ========================================================================
112+
-- Provides smooth scrolling and cursor animations for a better visual experience.
113+
--
114+
-- Features:
115+
-- - Smooth scrolling (when using Ctrl+D, Ctrl+U, etc.)
116+
-- - Cursor path animation when jumping
117+
-- - Window resize animations
118+
-- - Window open/close animations
119+
--
120+
-- All animations are non-blocking and can be customized or disabled independently.
121+
-- ========================================================================
122+
{
123+
'echasnovski/mini.animate',
124+
event = 'VeryLazy', -- Load after UI is ready
125+
opts = function()
126+
-- Don't use animate when scrolling with the mouse
127+
local mouse_scrolled = false
128+
for _, scroll in ipairs({ 'Up', 'Down' }) do
129+
local key = '<ScrollWheel' .. scroll .. '>'
130+
vim.keymap.set({ '', 'i' }, key, function()
131+
mouse_scrolled = true
132+
return key
133+
end, { expr = true })
134+
end
135+
136+
local animate = require('mini.animate')
137+
return {
138+
-- Cursor path animation - shows path when cursor jumps
139+
cursor = {
140+
enable = true,
141+
timing = animate.gen_timing.linear({ duration = 100, unit = 'total' }),
142+
},
143+
144+
-- Smooth scrolling
145+
scroll = {
146+
enable = true,
147+
timing = animate.gen_timing.linear({ duration = 150, unit = 'total' }),
148+
subscroll = animate.gen_subscroll.equal({
149+
predicate = function(total_scroll)
150+
if mouse_scrolled then
151+
mouse_scrolled = false
152+
return false
153+
end
154+
return total_scroll > 1
155+
end,
156+
}),
157+
},
158+
159+
-- Window resize animation
160+
resize = {
161+
enable = true,
162+
timing = animate.gen_timing.linear({ duration = 50, unit = 'total' }),
163+
},
164+
165+
-- Window open/close animation
166+
open = {
167+
enable = false, -- Disabled by default as it can be distracting
168+
timing = animate.gen_timing.linear({ duration = 150, unit = 'total' }),
169+
},
170+
171+
close = {
172+
enable = false, -- Disabled by default
173+
timing = animate.gen_timing.linear({ duration = 150, unit = 'total' }),
174+
},
175+
}
176+
end,
177+
},
178+
109179
-- ========================================================================
110180
-- ADDITIONAL COMMON PLUGINS
111181
-- ========================================================================

0 commit comments

Comments
 (0)