Documentation discrepancy?
sleewoo opened this issue · 4 comments
Hi,
is time
in README.md
a typo?
["<C-u>"] = function() neoscroll.ctrl_u({ time = 250 }) end;
init.lua
has duration
instead:
["<C-u>"] = function() neoscroll.ctrl_u({duration = 250}) end;
with this config:
local neoscroll = require("neoscroll")
neoscroll.setup({
mappings = { "C-Up", "C-Down", "C-A-Up", "C-A-Down" },
})
local keymap = {
["<C-Up>"] = function()
neoscroll.ctrl_u({ duration = 250 })
end,
["<C-Down>"] = function()
neoscroll.ctrl_d({ duration = 250 })
end,
["<C-A-Up>"] = function()
neoscroll.scroll(-0.1, { move_cursor = false, duration = 100 })
end,
["<C-A-Down>"] = function()
neoscroll.scroll(0.1, { move_cursor = false, duration = 100 })
end,
}
local modes = { "n", "v", "x" }
for key, func in pairs(keymap) do
vim.keymap.set(modes, key, func)
end
though works perfect if removing mappings
from setup:
neoscroll.setup()
...
most likely init.lua
should not try set keymap if key missing in function_mappings
https://github.com/karb94/neoscroll.nvim/blob/master/lua/neoscroll/init.lua#L372
Thank you for your report. I fixed the 'time' typos in the README.md
. Yes, the mappings
option should only accept :help neoscroll-default-mappings
. Now setup()
will throw and error if any of the supplied mappings are not in function_mappings
.
thanks.
used this to disable default mapping (to not overlap with my <C-e>
)
neoscroll.setup({ mappings = {} })
I just realised this is not mentioned explicitly in the docs so I added it to both the README and docs. Thanks!