mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-04 18:58:12 +00:00
feat: added new image
snacks plugin for the kitty graphics protocol
This commit is contained in:
parent
a17788539a
commit
4e4e63048e
18 changed files with 704 additions and 12 deletions
115
docs/image.md
Normal file
115
docs/image.md
Normal file
|
@ -0,0 +1,115 @@
|
|||
# 🍿 image
|
||||
|
||||
<!-- docgen -->
|
||||
|
||||
## 📦 Setup
|
||||
|
||||
```lua
|
||||
-- lazy.nvim
|
||||
{
|
||||
"folke/snacks.nvim",
|
||||
---@type snacks.Config
|
||||
opts = {
|
||||
image = {
|
||||
-- your image configuration comes here
|
||||
-- or leave it empty to use the default settings
|
||||
-- refer to the configuration section below
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## ⚙️ Config
|
||||
|
||||
```lua
|
||||
---@class snacks.image.Config
|
||||
---@field file? string
|
||||
{}
|
||||
```
|
||||
|
||||
## 📚 Types
|
||||
|
||||
```lua
|
||||
---@alias snacks.image.Dim {col: number, row: number, width: number, height: number}
|
||||
```
|
||||
|
||||
## 📦 Module
|
||||
|
||||
```lua
|
||||
---@class snacks.Image
|
||||
---@field id number
|
||||
---@field buf number
|
||||
---@field wins table<number, snacks.image.Dim>
|
||||
---@field opts snacks.image.Config
|
||||
---@field file string
|
||||
---@field _convert uv.uv_process_t?
|
||||
Snacks.image = {}
|
||||
```
|
||||
|
||||
### `Snacks.image.new()`
|
||||
|
||||
```lua
|
||||
---@param buf number
|
||||
---@param opts? snacks.image.Config
|
||||
Snacks.image.new(buf, opts)
|
||||
```
|
||||
|
||||
### `Snacks.image.supports()`
|
||||
|
||||
```lua
|
||||
---@param file string
|
||||
Snacks.image.supports(file)
|
||||
```
|
||||
|
||||
### `image:convert()`
|
||||
|
||||
```lua
|
||||
image:convert()
|
||||
```
|
||||
|
||||
### `image:create()`
|
||||
|
||||
```lua
|
||||
image:create()
|
||||
```
|
||||
|
||||
### `image:dim()`
|
||||
|
||||
```lua
|
||||
---@param win number
|
||||
---@return snacks.image.Dim
|
||||
image:dim(win)
|
||||
```
|
||||
|
||||
### `image:hide()`
|
||||
|
||||
```lua
|
||||
---@param win? number
|
||||
image:hide(win)
|
||||
```
|
||||
|
||||
### `image:ready()`
|
||||
|
||||
```lua
|
||||
image:ready()
|
||||
```
|
||||
|
||||
### `image:render()`
|
||||
|
||||
```lua
|
||||
---@param win number
|
||||
image:render(win)
|
||||
```
|
||||
|
||||
### `image:request()`
|
||||
|
||||
```lua
|
||||
---@param opts table<string, string|number>|{data?: string}
|
||||
image:request(opts)
|
||||
```
|
||||
|
||||
### `image:update()`
|
||||
|
||||
```lua
|
||||
image:update()
|
||||
```
|
|
@ -12,6 +12,7 @@
|
|||
---@field dim? snacks.dim.Config
|
||||
---@field explorer? snacks.explorer.Config
|
||||
---@field gitbrowse? snacks.gitbrowse.Config
|
||||
---@field image? snacks.image.Config
|
||||
---@field indent? snacks.indent.Config
|
||||
---@field input? snacks.input.Config
|
||||
---@field layout? snacks.layout.Config
|
||||
|
@ -55,6 +56,7 @@
|
|||
---@field git snacks.git
|
||||
---@field gitbrowse snacks.gitbrowse
|
||||
---@field health snacks.health
|
||||
---@field image snacks.image
|
||||
---@field indent snacks.indent
|
||||
---@field input snacks.input
|
||||
---@field layout snacks.layout
|
||||
|
|
10
docs/util.md
10
docs/util.md
|
@ -37,6 +37,16 @@ Snacks.util.bo(buf, bo)
|
|||
Snacks.util.color(group, prop)
|
||||
```
|
||||
|
||||
### `Snacks.util.debounce()`
|
||||
|
||||
```lua
|
||||
---@generic T
|
||||
---@param fn T
|
||||
---@param opts? {ms?:number}
|
||||
---@return T
|
||||
Snacks.util.debounce(fn, opts)
|
||||
```
|
||||
|
||||
### `Snacks.util.file_decode()`
|
||||
|
||||
Decodes a file name to a string.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue