Skip to content

[audit] snacks.nvim ships snacks.image — concrete migration path for the broken vim.ui.img in image.lua #286

Description

@stanfish06

What

lua/config/image.lua uses vim.ui.img.set() to display images — a pre-stable Neovim API flagged as fragile in issue #254. snacks.nvim (already installed and set up in lua/config/plugin_config.lua) ships a stable snacks.image module that provides the same capability with proper terminal-protocol detection.

Where

  • lua/config/image.lua — entire file (4 lines, never called)
  • lua/config/plugin_config.lua — snacks setup block (lines 424–446)

Why it matters

Issue #254 correctly identified vim.ui.img as a pre-stable internal API that can shift or disappear across Neovim versions. That issue left the migration path open. snacks.image fills it: it is a supported, versioned API inside an already-installed dependency, handles terminal detection (Kitty, iTerm2, etc.) automatically, and does not depend on any Neovim internal that could change.

Recommended action

  1. Enable image in the existing snacks.setup() call:
snacks.setup({
    image = { enabled = true },  -- add this
    scroll = { enabled = true },
    indent = { ... },
    notifier = { ... },
})
  1. Rewrite image.lua to use snacks.image:
local snacks_ok, snacks = pcall(require, "snacks")
if not snacks_ok then return end

local function preview_image(path)
    snacks.image.hover(path)  -- or snacks.image.open(path) depending on desired UX
end

-- Wire up an autocmd or keymap to call preview_image
  1. Remove the dead vim.ui.img.set() call entirely.

The snacks.image API supports both hover (transient float) and persistent display modes; see the snacks.nvim docs/image.md for details.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions