Skip to content

Latest commit

 

History

History
76 lines (60 loc) · 1.38 KB

scroll.md

File metadata and controls

76 lines (60 loc) · 1.38 KB

🍿 scroll

Smooth scrolling for Neovim. Properly handles scrolloff and mouse scrolling.

Similar plugins:

📦 Setup

-- lazy.nvim
{
  "folke/snacks.nvim",
  opts = {
    scroll = {
      -- your scroll configuration comes here
      -- or leave it empty to use the default settings
      -- refer to the configuration section below
    }
  }
}

⚙️ Config

---@class snacks.scroll.Config
---@field animate snacks.animate.Config
{
  animate = {
    duration = { step = 15, total = 250 },
    easing = "linear",
  },
  -- what buffers to animate
  filter = function(buf)
    return vim.g.snacks_scroll ~= false and vim.b[buf].snacks_scroll ~= false and vim.bo[buf].buftype ~= "terminal"
  end,
}

📚 Types

---@alias snacks.scroll.View {topline:number, lnum:number}
---@class snacks.scroll.State
---@field anim? snacks.animate.Animation
---@field win number
---@field buf number
---@field view vim.fn.winsaveview.ret
---@field current vim.fn.winsaveview.ret
---@field target vim.fn.winsaveview.ret
---@field scrolloff number
---@field virtualedit? string

📦 Module

Snacks.scroll.disable()

Snacks.scroll.disable()

Snacks.scroll.enable()

Snacks.scroll.enable()