luaneovimlazyvim

How to change lazyvim snacks animation speed


I like the animate feature that ships with lazyvim, however I just wish it were faster. In looking at the docs:

https://github.com/folke/snacks.nvim/blob/main/docs/animate.md

It indicates that there are three options one can configure, duration, fps, easing. I have a snacks.lua configuration file in ~/.config/lazyvim/lua/plugins/snacks.lua that has the following:

return {
  "folke/snacks.nvim",
  opts = {
    animate = {
      duration = 5,  -- seems to have no effect
      fps = 60,  -- does have an effect
    }
  }
}

If I lower the fps from the default 60, the animation is definitely choppier so I know that is working. However, changing the duration parameter seems to have no effect. I'm just wondering if I am doing something wrong or misinterpreting this here and how I can speed up the animations.


Solution

  • I had a similar issue and was able to resolve my problem by inserting the animate config directly into the scroll config like so

    return {
      "folke/snacks.nvim",
      opts = {
        scroll = {
          enabled = true,
          animate = {
            duration = { step = 10, total = 100 },
            easing = "linear",
          },
          -- faster animation when repeating scroll after delay
          animate_repeat = {
            delay = 50, -- delay in ms before using the repeat animation
            duration = { step = 3, total = 20 },
            easing = "linear",
          },
        },
      },
    }