Skip to content

[audit] image.lua: preview_image() is dead code — complete or remove #175

@stanfish06

Description

@stanfish06

What

lua/config/image.lua defines a preview_image() function that is never called, never exported from the module, and has commented-out window-creation code. The file is required from init.lua but contributes nothing at startup.

Where

lua/config/image.lua (full file, 12 lines):

local function preview_image(path)
    local id = vim.ui.img.set(
        vim.fn.readblob(path),
        { row = 0, col = 0, width = 100, height = 50, zindex = 0 }
    )
    return id
end

init.lua:7require("config.image") loads this file every startup.

Why it matters

  1. Silently non-functional: vim.ui.img.set() is an experimental Neovim 0.12 image API. The function is never invoked, so any API breakage goes undetected.
  2. Misleading require: The init.lua load implies something happens at startup, but nothing does.
  3. Incomplete feature: Commented-out window-creation code suggests a float-based image preview was planned but never finished.

Recommended action

Option A — Remove: Delete lua/config/image.lua and the require("config.image") line in init.lua:7 until the feature is ready.

Option B — Complete: Wire preview_image() to a :PreviewImage command or keymap that opens an image in a float. Guard with if vim.fn.has("nvim-0.12") == 1.

Option C — Mark as stub: Add a -- TODO comment and keep the file as a placeholder for when vim.ui.img stabilises.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions