nixvim-for-share/config/plugins/neoscroll.nix
2025-07-26 12:43:01 +00:00

30 lines
1.1 KiB
Nix

{ helpers, ... }:
{
plugins = {
neoscroll = {
enable = true;
settings = {
easing_function = "sine";
};
};
};
# https://github.com/karb94/neoscroll.nvim
extraConfigLua = ''
neoscroll = require('neoscroll')
local keymap = {
["<C-u>"] = function() neoscroll.ctrl_u({ duration = 80 }) end;
["<C-d>"] = function() neoscroll.ctrl_d({ duration = 80 }) end;
["<C-b>"] = function() neoscroll.ctrl_b({ duration = 80 }) end;
["<C-f>"] = function() neoscroll.ctrl_f({ duration = 80 }) end;
["<C-y>"] = function() neoscroll.scroll(-0.1, { move_cursor=false; duration = 40 }) end;
["<C-e>"] = function() neoscroll.scroll(0.1, { move_cursor=false; duration = 40 }) end;
["zt"] = function() neoscroll.zt({ half_win_duration = 80 }) end;
["zz"] = function() neoscroll.zz({ half_win_duration = 80 }) end;
["zb"] = function() neoscroll.zb({ half_win_duration = 80 }) end;
}
local modes = { 'n', 'v', 'x' }
for key, func in pairs(keymap) do
vim.keymap.set(modes, key, func)
end
'';
}