From 30cf2067e916b8c3bd31b775b75de32eda9a0cee Mon Sep 17 00:00:00 2001 From: Anup Sebastian <56888132+anupjsebastian@users.noreply.github.com> Date: Fri, 31 Oct 2025 22:16:07 -0500 Subject: [PATCH] feat: scrolling animations --- lazy-lock.json | 9 ++--- lua/custom/plugins/init.lua | 70 +++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+), 4 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index e2139838..81bcf3a0 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -11,16 +11,17 @@ "gitsigns.nvim": { "branch": "main", "commit": "20ad4419564d6e22b189f6738116b38871082332" }, "guess-indent.nvim": { "branch": "main", "commit": "84a4987ff36798c2fc1169cbaff67960aed9776f" }, "lazy.nvim": { "branch": "main", "commit": "f0f5bbb9e5bfae5e6468f9359ffea3d151418176" }, - "lazydev.nvim": { "branch": "main", "commit": "371cd7434cbf95606f1969c2c744da31b77fcfa6" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "d7b5feb6e769e995f7fcf44d92f49f811c51d10c" }, + "lazydev.nvim": { "branch": "main", "commit": "faf46237f0df43a29e12abd143ff1a0bbac27b7e" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "3590d66effccc7376d8c3dbe45e8291f9fed2843" }, "mason-tool-installer.nvim": { "branch": "main", "commit": "517ef5994ef9d6b738322664d5fdd948f0fdeb46" }, "mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" }, - "mini.nvim": { "branch": "main", "commit": "e96ef335c7c68d2bc6359cdb7cf0941889df9be0" }, + "mini.animate": { "branch": "main", "commit": "8ce6df739aa9d14c876bace722af28c3d09e9971" }, + "mini.nvim": { "branch": "main", "commit": "ee4a4a4abed25e3d108d985b0553c5271f2f71aa" }, "neo-tree.nvim": { "branch": "main", "commit": "8cdd6b1940f333c1dd085526a9c45b30fb2dbf50" }, "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, "nvim-dap": { "branch": "master", "commit": "6782b097af2417a4c3e33849b0a26ae2188bd7ea" }, "nvim-dap-ui": { "branch": "master", "commit": "cf91d5e2d07c72903d052f5207511bf7ecdb7122" }, - "nvim-lspconfig": { "branch": "master", "commit": "e25994a1c2373784364852cd904cb39b6d75f227" }, + "nvim-lspconfig": { "branch": "master", "commit": "c8c9420b7676caf14e1e1d96caed204a81ba860f" }, "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index a719b687..6a305786 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -106,6 +106,76 @@ return { end, }, + -- ======================================================================== + -- SMOOTH SCROLLING & ANIMATIONS - mini.animate + -- ======================================================================== + -- Provides smooth scrolling and cursor animations for a better visual experience. + -- + -- Features: + -- - Smooth scrolling (when using Ctrl+D, Ctrl+U, etc.) + -- - Cursor path animation when jumping + -- - Window resize animations + -- - Window open/close animations + -- + -- All animations are non-blocking and can be customized or disabled independently. + -- ======================================================================== + { + 'echasnovski/mini.animate', + event = 'VeryLazy', -- Load after UI is ready + opts = function() + -- Don't use animate when scrolling with the mouse + local mouse_scrolled = false + for _, scroll in ipairs({ 'Up', 'Down' }) do + local key = '' + vim.keymap.set({ '', 'i' }, key, function() + mouse_scrolled = true + return key + end, { expr = true }) + end + + local animate = require('mini.animate') + return { + -- Cursor path animation - shows path when cursor jumps + cursor = { + enable = true, + timing = animate.gen_timing.linear({ duration = 100, unit = 'total' }), + }, + + -- Smooth scrolling + scroll = { + enable = true, + 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, + }), + }, + + -- Window resize animation + resize = { + enable = true, + timing = animate.gen_timing.linear({ duration = 50, unit = 'total' }), + }, + + -- Window open/close animation + open = { + enable = false, -- Disabled by default as it can be distracting + timing = animate.gen_timing.linear({ duration = 150, unit = 'total' }), + }, + + close = { + enable = false, -- Disabled by default + timing = animate.gen_timing.linear({ duration = 150, unit = 'total' }), + }, + } + end, + }, + -- ======================================================================== -- ADDITIONAL COMMON PLUGINS -- ========================================================================