Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/niuiic/scroll.nvim
Smooth scroll for neovim.
https://github.com/niuiic/scroll.nvim
Last synced: about 1 month ago
JSON representation
Smooth scroll for neovim.
- Host: GitHub
- URL: https://github.com/niuiic/scroll.nvim
- Owner: niuiic
- License: mit
- Created: 2024-04-30T00:41:16.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2024-04-30T09:01:25.000Z (about 1 month ago)
- Last Synced: 2024-05-01T01:44:02.117Z (about 1 month ago)
- Language: Lua
- Homepage:
- Size: 3.91 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Lists
- awesome-neovim - niuiic/scroll.nvim - Smooth scrolling, custom smooth strategy. (Scrolling / Treesitter Based)
- trackawesomelist - niuiic/scroll.nvim (⭐0) - Smooth scrolling, custom smooth strategy. (Recently Updated / [Apr 30, 2024](/content/2024/04/30/README.md))
README
# scroll.nvim
Smooth scroll for neovim.
- Custom smooth strategy.
- Keep simple, keep reliable.## Usage
```lua
local keys = {
{
"",
function()
local screen_h = vim.opt.lines:get() - vim.opt.cmdheight:get()
local target_line = vim.api.nvim_win_get_cursor(0)[1] + screen_h / 2
local step = screen_h / 2 / 50
if step < 1 then
step = 1
endrequire("scroll").scroll(target_line, function(current_line)
return {
next_line = current_line + step,
-- 10ms
delay = 10,
}
end)
end,
desc = "scroll down",
mode = { "x", "n" },
},
{
"",
function()
local screen_h = vim.opt.lines:get() - vim.opt.cmdheight:get()
local target_line = vim.api.nvim_win_get_cursor(0)[1] - screen_h / 2
local step = screen_h / 2 / 50
if step < 1 then
step = 1
endrequire("scroll").scroll(target_line, function(current_line)
return {
next_line = current_line - step,
delay = 10,
}
end)
end,
desc = "scroll up",
mode = { "x", "n" },
},
}
```## Config
No configuration options available.