mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-03 10:22:43 +00:00
2.2 KiB
2.2 KiB
🍿 image
Image viewer using the Kitty Graphics Protocol.
Supported terminals:
In order to automatically display the image when openinng an image file,
you need to enable the image
plugin in your snacks
config.
Supported image formats:
- PNG
- JPEG/JPG
- GIF
- BMP
- WEBP
ImageMagick is required to convert images to the supported formats (all except PNG).
📦 Setup
-- 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
---@class snacks.image.Config
---@field file? string
{}
📚 Types
---@alias snacks.image.Dim {col: number, row: number, width: number, height: number}
📦 Module
---@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()
---@param buf number
---@param opts? snacks.image.Config
Snacks.image.new(buf, opts)
Snacks.image.supports()
---@param file string
Snacks.image.supports(file)
image:convert()
---@param file string
image:convert(file)
image:create()
image:create()
image:grid_size()
image:grid_size()
image:hide()
image:hide()
image:ready()
image:ready()
image:render()
Renders the unicode placeholder grid in the buffer
---@param width number
---@param height number
image:render(width, height)
image:request()
---@param opts table<string, string|number>|{data?: string}
image:request(opts)
image:update()
image:update()