scroll.lua 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. local M = {
  2. "karb94/neoscroll.nvim",
  3. }
  4. M.config = function()
  5. require("neoscroll").setup({
  6. -- All these keys will be mapped to their corresponding default scrolling animation
  7. mappings = { "<C-u>", "<C-d>" },
  8. hide_cursor = true, -- Hide cursor while scrolling
  9. stop_eof = true, -- Stop at <EOF> when scrolling downwards
  10. respect_scrolloff = false, -- Stop scrolling when the cursor reaches the scrolloff margin of the file
  11. cursor_scrolls_alone = true, -- The cursor will keep on scrolling even if the window cannot scroll further
  12. easing_function = nil, -- Default easing function
  13. pre_hook = nil, -- Function to run before the scrolling animation starts
  14. post_hook = nil, -- Function to run after the scrolling animation ends
  15. performance_mode = false, -- Disable "Performance Mode" on all buffers.
  16. })
  17. local neoscroll = require("neoscroll")
  18. local t = {
  19. ["<C-u>"] = function()
  20. neoscroll.ctrl_u({ duration = 50 })
  21. end,
  22. ["<C-k>"] = function()
  23. neoscroll.ctrl_u({ duration = 50 })
  24. end,
  25. ["<C-d>"] = function()
  26. neoscroll.ctrl_d({ duration = 50 })
  27. end,
  28. ["<C-j>"] = function()
  29. neoscroll.ctrl_d({ duration = 50 })
  30. end,
  31. }
  32. local modes = { "n", "v", "x" }
  33. for key, func in pairs(t) do
  34. vim.keymap.set(modes, key, func)
  35. end
  36. end
  37. return M