mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-04 10:49:08 +00:00
feat(win): Snacks.win:scroll
This commit is contained in:
parent
7383edaec8
commit
a1da66e3bf
1 changed files with 10 additions and 0 deletions
|
@ -98,6 +98,8 @@ Snacks.config.style("minimal", {
|
|||
},
|
||||
})
|
||||
|
||||
local SCROLL_UP, SCROLL_DOWN = Snacks.util.keycode("<c-u>"), Snacks.util.keycode("<c-d>")
|
||||
|
||||
local split_commands = {
|
||||
editor = {
|
||||
top = "topleft",
|
||||
|
@ -246,6 +248,14 @@ function M:focus()
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
---@param up? boolean
|
||||
function M:scroll(up)
|
||||
vim.api.nvim_buf_call(self.buf, function()
|
||||
vim.cmd(("normal! %s"):format(up and SCROLL_UP or SCROLL_DOWN))
|
||||
end)
|
||||
end
|
||||
|
||||
---@param opts? { buf: boolean }
|
||||
function M:close(opts)
|
||||
opts = opts or {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue