karb94 / neoscroll.nvim

Smooth scrolling neovim plugin written in lua
MIT License
1.46k stars 36 forks source link

Latest commit (88e63a8) issues #103

Closed cdmill closed 5 months ago

cdmill commented 5 months ago

After updating to the latest commit I'm running into a few issues.

My previous config (below) now has errors because line 17 in neoscroll/config.lua is expecting a table but is getting nil. The docs still use require("neoscroll").setup() in the quickstart section, so I don't think this is intended. This error will obviously go away if passing an empty table or any custom opts.

  {
    "karb94/neoscroll.nvim",
    event = { "BufReadPost", "BufNewFile" },
    config = function()
      require("neoscroll").setup()
    end,
  },

If the error is ignored then no scrolling animations happen. If i pass a table (empty or with custom opts) and then for example use zb I get the following error happening in neoscroll/init.lua line 298 "attempting to perform arithmetic on local 'half_win_duration' ( a table value)".

srirambtechit commented 5 months ago

I got the very same error after update today.

Failed to run `config` for neoscroll.nvim

.../share/nvim/lazy/neoscroll.nvim/lua/neoscroll/config.lua:17: bad argument #1 to 'pairs' (table expected, got nil)

Then, I just passed the mapping options (something to reinitialize on setup), it worked.

{
    "karb94/neoscroll.nvim",
    event = { "BufReadPost", "BufNewFile" },
    config = function()
      local opts = {
        mappings = {
          "<C-u>",
          "<C-d>",
        },
      }
      require("neoscroll").setup(opts)
    end,
}
agusdmb commented 5 months ago

same here

b0ae989c commented 5 months ago

Some new interfaces have bugs in duration calculation. For example: https://github.com/karb94/neoscroll.nvim/blob/88e63a89fee0f6112f0477a5709a460c45e5dee9/lua/neoscroll/init.lua#L242

b0ae989c commented 5 months ago

Update: these bugs don't affect many users because they remove all default mappings, and set up mappings with require('neoscroll.config').set_mappings, which calls the bug-free <cmd>lua require('neoscroll'). interfaces.

karb94 commented 5 months ago

Sorry about this. I'll fix it in a few hours.

karb94 commented 5 months ago

Let me know if the last commit didn't fix all of your issues.