docs: docgen

This commit is contained in:
Folke Lemaitre 2024-12-12 08:44:47 +01:00
parent 25c290d7c0
commit 851dc7854b
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
7 changed files with 51 additions and 1 deletions

View file

@ -18,6 +18,13 @@ Efficient animation library including over 45 easing functions:
Theres at any given time at most one timer running, that takes care of all
active animations, controlled by the `fps` setting.
You can at any time disable all animations with:
- `vim.g.snacks_animate = false` globally
- `vim.b.snacks_animate = false` locally for the buffer
Doing this, will disable `scroll`, `indent`, `dim` and all other animations.
==============================================================================
1. Setup *snacks-animate-setup*
@ -80,6 +87,7 @@ both are specified, the minimum of both is used.
>lua
---@class snacks.animate.Opts: snacks.animate.Config
---@field buf? number optional buffer to check if animations should be enabled
---@field int? boolean interpolate the value to an integer
---@field id? number|string unique identifier for the animation
<

View file

@ -82,11 +82,13 @@ The indent-based algorithm is similar to what is used in mini.indentscope
---@type table<string, snacks.scope.TextObject|{desc?:string}>
textobject = {
ii = {
min_size = 1, -- allow single line scopes
edge = false, -- don't include the edge
treesitter = { enabled = false },
desc = "inner scope",
},
ai = {
min_size = 1, -- allow single line scopes
edge = true, -- include the edge
treesitter = { enabled = false },
desc = "scope with edge",
@ -95,12 +97,14 @@ The indent-based algorithm is similar to what is used in mini.indentscope
---@type table<string, snacks.scope.Jump|{desc?:string}>
jump = {
["[i"] = {
min_size = 1, -- allow single line scopes
bottom = false,
edge = true,
treesitter = { enabled = false },
desc = "jump to top edge of scope",
},
["]i"] = {
min_size = 1, -- allow single line scopes
bottom = true,
edge = true,
treesitter = { enabled = false },

View file

@ -8,6 +8,7 @@ Table of Contents *snacks-toggle-table-of-contents*
3. Types |snacks-toggle-types|
4. Module |snacks-toggle-module|
- Snacks.toggle() |snacks-toggle-module-snacks.toggle()|
- Snacks.toggle.animate() |snacks-toggle-module-snacks.toggle.animate()|
- Snacks.toggle.diagnostics()|snacks-toggle-module-snacks.toggle.diagnostics()|
- Snacks.toggle.dim() |snacks-toggle-module-snacks.toggle.dim()|
- Snacks.toggle.get() |snacks-toggle-module-snacks.toggle.get()|
@ -22,6 +23,7 @@ Table of Contents *snacks-toggle-table-of-contents*
- Snacks.toggle.treesitter()|snacks-toggle-module-snacks.toggle.treesitter()|
- Snacks.toggle.words() |snacks-toggle-module-snacks.toggle.words()|
- Snacks.toggle.zen() |snacks-toggle-module-snacks.toggle.zen()|
- Snacks.toggle.zoom() |snacks-toggle-module-snacks.toggle.zoom()|
5. Links |snacks-toggle-links|
Toggle keymaps integrated with which-key icons / colors
@ -93,6 +95,13 @@ Toggle keymaps integrated with which-key icons / colors
<
`Snacks.toggle.animate()` *Snacks.toggle.animate()*
>lua
Snacks.toggle.animate()
<
`Snacks.toggle.diagnostics()` *Snacks.toggle.diagnostics()*
>lua
@ -199,6 +208,13 @@ Toggle keymaps integrated with which-key icons / colors
Snacks.toggle.zen()
<
`Snacks.toggle.zoom()` *Snacks.toggle.zoom()*
>lua
Snacks.toggle.zoom()
<
==============================================================================
5. Links *snacks-toggle-links*

View file

@ -12,6 +12,7 @@ Table of Contents *snacks-util-table-of-contents*
- Snacks.util.file_encode() |snacks-util-module-snacks.util.file_encode()|
- Snacks.util.icon() |snacks-util-module-snacks.util.icon()|
- Snacks.util.is_transparent()|snacks-util-module-snacks.util.is_transparent()|
- Snacks.util.keycode() |snacks-util-module-snacks.util.keycode()|
- Snacks.util.on_module() |snacks-util-module-snacks.util.on_module()|
- Snacks.util.redraw() |snacks-util-module-snacks.util.redraw()|
- Snacks.util.redraw_range() |snacks-util-module-snacks.util.redraw_range()|
@ -101,6 +102,14 @@ Check if the colorscheme is transparent.
<
`Snacks.util.keycode()` *Snacks.util.keycode()*
>lua
---@param str string
Snacks.util.keycode(str)
<
`Snacks.util.on_module()` *Snacks.util.on_module()*
Call a function when a module is loaded. The callback is called immediately if

View file

@ -8,6 +8,13 @@ Efficient animation library including over 45 easing functions:
There's at any given time at most one timer running, that takes
care of all active animations, controlled by the `fps` setting.
You can at any time disable all animations with:
- `vim.g.snacks_animate = false` globally
- `vim.b.snacks_animate = false` locally for the buffer
Doing this, will disable `scroll`, `indent`, `dim` and all other animations.
<!-- docgen -->
## 📦 Setup
@ -67,6 +74,7 @@ When both are specified, the minimum of both is used.
```lua
---@class snacks.animate.Opts: snacks.animate.Config
---@field buf? number optional buffer to check if animations should be enabled
---@field int? boolean interpolate the value to an integer
---@field id? number|string unique identifier for the animation
```

View file

@ -64,6 +64,12 @@ Toggle keymaps integrated with which-key icons / colors
Snacks.toggle()
```
### `Snacks.toggle.animate()`
```lua
Snacks.toggle.animate()
```
### `Snacks.toggle.diagnostics()`
```lua

View file

@ -298,7 +298,6 @@ function TSScope:fix()
end
function TSScope:with_edge()
-- FIXME: this is incorrect if the scope is already at the edge
local prev = vim.fn.prevnonblank(self.from - 1)
local next = vim.fn.nextnonblank(self.from + 1)
if vim.fn.indent(next) > self.indent then