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.

Lists

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
end

require("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
end

require("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.