Skip to content

Image Preview Extra

ui.image-preview enables Snacks image rendering. It can preview image files and render supported document images in terminals that understand the Kitty graphics protocol.

Enable it

-- ~/.config/blak/lua/blak/user.lua
return {
extras = {
enabled = {
"ui.image-preview",
},
},
}

Or enable it interactively:

:BlakExtras enable ui.image-preview

What it adds

SurfaceContribution
Snacksimage.enabled = true
Terminal supportKitty, Ghostty, WezTerm, and tmux passthrough where available
External toolsImageMagick for conversion of non-PNG formats

Configure image rendering

Add Snacks image options under snacks.image:

return {
extras = {
enabled = { "ui.image-preview" },
},
snacks = {
image = {
force = false,
doc = {
enabled = true,
inline = true,
float = true,
max_width = 80,
max_height = 40,
},
img_dirs = { "img", "images", "assets", "static", "public" },
},
},
}

If inline rendering behaves poorly in your terminal, keep previews in floats:

return {
extras = {
enabled = { "ui.image-preview" },
},
snacks = {
image = {
doc = {
inline = false,
float = true,
},
},
},
}

Terminal notes

Snacks can auto-detect supported terminals. If your environment is unusual, set one of Snacks’ environment flags before launching Neovim:

Terminal window
SNACKS_GHOSTTY=true blak

For tmux, make sure passthrough is enabled if images do not display.

Verify it

Run:

:checkhealth snacks
:BlakDoctor

Then open a PNG or a Markdown file with an image reference.