fix: Repeated fields in neoscroll config

This commit is contained in:
Sayantan Santra 2024-09-06 09:34:24 +02:00
parent fb52609b7a
commit 8dda9627af
Signed by: SinTan1729
GPG key ID: EB3E68BFBA25C85F
3 changed files with 30 additions and 36 deletions

View file

@ -4,30 +4,28 @@ local neoscroll = require("neoscroll")
vim.opt.scrolloff = 8 vim.opt.scrolloff = 8
neoscroll.setup({ neoscroll.setup({
-- All these keys will be mapped to their corresponding default scrolling animation -- Default easing function used in any animation where
mappings = { '<C-u>', '<C-d>', '<C-b>', '<C-f>', -- the `easing` argument has not been explicitly supplied
'<C-y>', '<C-e>', 'zt', 'zz', 'zb' },
hide_cursor = true, -- Hide cursor while scrolling hide_cursor = true, -- Hide cursor while scrolling
stop_eof = true, -- Stop at <EOF> when scrolling downwards stop_eof = true, -- Stop at <EOF> when scrolling downwards
respect_scrolloff = false, -- Stop scrolling when the cursor reaches the scrolloff margin of the file respect_scrolloff = false, -- Stop scrolling when the cursor reaches the scrolloff margin of the file
cursor_scrolls_alone = true, -- The cursor will keep on scrolling even if the window cannot scroll further cursor_scrolls_alone = true, -- The cursor will keep on scrolling even if the window cannot scroll further
easing_function = nil, -- Default easing function easing_function = "quadratic", -- Default easing function
pre_hook = nil, -- Function to run before the scrolling animation starts pre_hook = nil, -- Function to run before the scrolling animation starts
post_hook = nil, -- Function to run after the scrolling animation ends post_hook = nil, -- Function to run after the scrolling animation ends
performance_mode = false, -- Disable "Performance Mode" on all buffers. performance_mode = false, -- Disable "Performance Mode" on all buffers.
easing_function = "quadratic", -- Default easing function
}) })
local keymap = { local keymap = {
["<C-u>"] = function() neoscroll.ctrl_u({ duration = 250 }) end, -- Use the "sine" easing function
["<C-d>"] = function() neoscroll.ctrl_d({ duration = 250 }) end, ["<C-u>"] = function() neoscroll.ctrl_u({ duration = 250, easing = 'sine' }) end,
["<C-b>"] = function() neoscroll.ctrl_b({ duration = 450 }) end, ["<C-d>"] = function() neoscroll.ctrl_d({ duration = 250, easing = 'sine' }) end,
["<C-f>"] = function() neoscroll.ctrl_f({ duration = 450 }) end, -- Use the "circular" easing function
["<C-b>"] = function() neoscroll.ctrl_b({ duration = 450, easing = 'circular' }) end,
["<C-f>"] = function() neoscroll.ctrl_f({ duration = 450, easing = 'circular' }) end,
-- When no value is passed the `easing` option supplied in `setup()` is used
["<C-y>"] = function() neoscroll.scroll(-0.1, { move_cursor = false, duration = 100 }) end, ["<C-y>"] = function() neoscroll.scroll(-0.1, { move_cursor = false, duration = 100 }) end,
["<C-e>"] = function() neoscroll.scroll(0.1, { move_cursor = false, duration = 100 }) end, ["<C-e>"] = function() neoscroll.scroll(0.1, { move_cursor = false, duration = 100 }) end,
["zt"] = function() neoscroll.zt({ half_win_duration = 250 }) end,
["zz"] = function() neoscroll.zz({ half_win_duration = 250 }) end,
["zb"] = function() neoscroll.zb({ half_win_duration = 250 }) end,
} }
local modes = { 'n', 'v', 'x' } local modes = { 'n', 'v', 'x' }

View file

@ -4,30 +4,28 @@ local neoscroll = require("neoscroll")
vim.opt.scrolloff = 8 vim.opt.scrolloff = 8
neoscroll.setup({ neoscroll.setup({
-- All these keys will be mapped to their corresponding default scrolling animation -- Default easing function used in any animation where
mappings = { '<C-u>', '<C-d>', '<C-b>', '<C-f>', -- the `easing` argument has not been explicitly supplied
'<C-y>', '<C-e>', 'zt', 'zz', 'zb' },
hide_cursor = true, -- Hide cursor while scrolling hide_cursor = true, -- Hide cursor while scrolling
stop_eof = true, -- Stop at <EOF> when scrolling downwards stop_eof = true, -- Stop at <EOF> when scrolling downwards
respect_scrolloff = false, -- Stop scrolling when the cursor reaches the scrolloff margin of the file respect_scrolloff = false, -- Stop scrolling when the cursor reaches the scrolloff margin of the file
cursor_scrolls_alone = true, -- The cursor will keep on scrolling even if the window cannot scroll further cursor_scrolls_alone = true, -- The cursor will keep on scrolling even if the window cannot scroll further
easing_function = nil, -- Default easing function easing_function = "quadratic", -- Default easing function
pre_hook = nil, -- Function to run before the scrolling animation starts pre_hook = nil, -- Function to run before the scrolling animation starts
post_hook = nil, -- Function to run after the scrolling animation ends post_hook = nil, -- Function to run after the scrolling animation ends
performance_mode = false, -- Disable "Performance Mode" on all buffers. performance_mode = false, -- Disable "Performance Mode" on all buffers.
easing_function = "quadratic", -- Default easing function
}) })
local keymap = { local keymap = {
["<C-u>"] = function() neoscroll.ctrl_u({ duration = 250 }) end, -- Use the "sine" easing function
["<C-d>"] = function() neoscroll.ctrl_d({ duration = 250 }) end, ["<C-u>"] = function() neoscroll.ctrl_u({ duration = 250, easing = 'sine' }) end,
["<C-b>"] = function() neoscroll.ctrl_b({ duration = 450 }) end, ["<C-d>"] = function() neoscroll.ctrl_d({ duration = 250, easing = 'sine' }) end,
["<C-f>"] = function() neoscroll.ctrl_f({ duration = 450 }) end, -- Use the "circular" easing function
["<C-b>"] = function() neoscroll.ctrl_b({ duration = 450, easing = 'circular' }) end,
["<C-f>"] = function() neoscroll.ctrl_f({ duration = 450, easing = 'circular' }) end,
-- When no value is passed the `easing` option supplied in `setup()` is used
["<C-y>"] = function() neoscroll.scroll(-0.1, { move_cursor = false, duration = 100 }) end, ["<C-y>"] = function() neoscroll.scroll(-0.1, { move_cursor = false, duration = 100 }) end,
["<C-e>"] = function() neoscroll.scroll(0.1, { move_cursor = false, duration = 100 }) end, ["<C-e>"] = function() neoscroll.scroll(0.1, { move_cursor = false, duration = 100 }) end,
["zt"] = function() neoscroll.zt({ half_win_duration = 250 }) end,
["zz"] = function() neoscroll.zz({ half_win_duration = 250 }) end,
["zb"] = function() neoscroll.zb({ half_win_duration = 250 }) end,
} }
local modes = { 'n', 'v', 'x' } local modes = { 'n', 'v', 'x' }

View file

@ -4,30 +4,28 @@ local neoscroll = require("neoscroll")
vim.opt.scrolloff = 8 vim.opt.scrolloff = 8
neoscroll.setup({ neoscroll.setup({
-- All these keys will be mapped to their corresponding default scrolling animation -- Default easing function used in any animation where
mappings = { '<C-u>', '<C-d>', '<C-b>', '<C-f>', -- the `easing` argument has not been explicitly supplied
'<C-y>', '<C-e>', 'zt', 'zz', 'zb' },
hide_cursor = true, -- Hide cursor while scrolling hide_cursor = true, -- Hide cursor while scrolling
stop_eof = true, -- Stop at <EOF> when scrolling downwards stop_eof = true, -- Stop at <EOF> when scrolling downwards
respect_scrolloff = false, -- Stop scrolling when the cursor reaches the scrolloff margin of the file respect_scrolloff = false, -- Stop scrolling when the cursor reaches the scrolloff margin of the file
cursor_scrolls_alone = true, -- The cursor will keep on scrolling even if the window cannot scroll further cursor_scrolls_alone = true, -- The cursor will keep on scrolling even if the window cannot scroll further
easing_function = nil, -- Default easing function easing_function = "quadratic", -- Default easing function
pre_hook = nil, -- Function to run before the scrolling animation starts pre_hook = nil, -- Function to run before the scrolling animation starts
post_hook = nil, -- Function to run after the scrolling animation ends post_hook = nil, -- Function to run after the scrolling animation ends
performance_mode = false, -- Disable "Performance Mode" on all buffers. performance_mode = false, -- Disable "Performance Mode" on all buffers.
easing_function = "quadratic", -- Default easing function
}) })
local keymap = { local keymap = {
["<C-u>"] = function() neoscroll.ctrl_u({ duration = 250 }) end, -- Use the "sine" easing function
["<C-d>"] = function() neoscroll.ctrl_d({ duration = 250 }) end, ["<C-u>"] = function() neoscroll.ctrl_u({ duration = 250, easing = 'sine' }) end,
["<C-b>"] = function() neoscroll.ctrl_b({ duration = 450 }) end, ["<C-d>"] = function() neoscroll.ctrl_d({ duration = 250, easing = 'sine' }) end,
["<C-f>"] = function() neoscroll.ctrl_f({ duration = 450 }) end, -- Use the "circular" easing function
["<C-b>"] = function() neoscroll.ctrl_b({ duration = 450, easing = 'circular' }) end,
["<C-f>"] = function() neoscroll.ctrl_f({ duration = 450, easing = 'circular' }) end,
-- When no value is passed the `easing` option supplied in `setup()` is used
["<C-y>"] = function() neoscroll.scroll(-0.1, { move_cursor = false, duration = 100 }) end, ["<C-y>"] = function() neoscroll.scroll(-0.1, { move_cursor = false, duration = 100 }) end,
["<C-e>"] = function() neoscroll.scroll(0.1, { move_cursor = false, duration = 100 }) end, ["<C-e>"] = function() neoscroll.scroll(0.1, { move_cursor = false, duration = 100 }) end,
["zt"] = function() neoscroll.zt({ half_win_duration = 250 }) end,
["zz"] = function() neoscroll.zz({ half_win_duration = 250 }) end,
["zb"] = function() neoscroll.zb({ half_win_duration = 250 }) end,
} }
local modes = { 'n', 'v', 'x' } local modes = { 'n', 'v', 'x' }