Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is there a way to temporarily disable animation? #54

Closed
KevinNitroG opened this issue Jul 12, 2024 · 5 comments · Fixed by #62
Closed

is there a way to temporarily disable animation? #54

KevinNitroG opened this issue Jul 12, 2024 · 5 comments · Fixed by #62

Comments

@KevinNitroG
Copy link

KevinNitroG commented Jul 12, 2024

Hi, I want to ask if there is a way to temporarily disable animation. I saw a way to do that in echasnovski/mini.animate to disable animation globally or for a buffer, and it is used in LazyVim.

vim.filetype.add({
  pattern = {
    [".*"] = {
      function(path, buf)
        return vim.bo[buf]
            and vim.bo[buf].filetype ~= "bigfile"
            and path
            and vim.fn.getfsize(path) > vim.g.bigfile_size
            and "bigfile"
          or nil
      end,
    },
  },
})

vim.api.nvim_create_autocmd({ "FileType" }, {
  group = augroup("bigfile"),
  pattern = "bigfile",
  callback = function(ev)
    vim.b.minianimate_disable = true
    vim.schedule(function()
      vim.bo[ev.buf].syntax = vim.filetype.match({ buf = ev.buf }) or ""
    end)
  end,
})

It would be nice to temporarily disable animation for big files. And I wonder do we have some kinds like that in our plugin?

Thank you anyway!

@declancm
Copy link
Owner

No sorry, but I'll definitely add that ASAP!

@declancm
Copy link
Owner

You can disable the animation for large movements by setting the 'max_delta' config option

To disable scrolling for movements larger than 200 lines (or columns):

require("cinnamon").setup({
    options = {
         max_delta = {
             line = 200,
             column = 200,
         },
    },
})

@KevinNitroG
Copy link
Author

KevinNitroG commented Jul 12, 2024

You can disable the animation for large movements by setting the 'max_delta' config option

To disable scrolling for movements larger than 200 lines (or columns):

require("cinnamon").setup({
    options = {
         max_delta = {
             line = 200,
             column = 200,
         },
    },
})

Huhm I think it's not quite enough for me. Because with just a large file, a small movement like <C-d> still makes a noticeable delay and lag. 🙁

@declancm
Copy link
Owner

Hopefully this fixes your lag with large files! I'll still add an option for disabling cinnamon per buffer either way

@KevinNitroG
Copy link
Author

Hopefully this fixes your lag with large files! I'll still add an option for disabling cinnamon per buffer either way

Thank you! It's work great (:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants