nvim-neo-tree / neo-tree.nvim

Neovim plugin to manage the file system and other tree like structures.
MIT License
3.61k stars 210 forks source link

BUG: image preview doesn't work #1373

Open sinelnikov-web opened 6 months ago

sinelnikov-web commented 6 months ago

Did you check docs and existing issues?

Neovim Version (nvim -v)

0.9.5

Operating System / Version

MacOS 14.3.1

Describe the Bug

I have the image.nvim dependency installed, and the setting for image_preview is also explicitly specified, but image doesn't render

Screenshots, Traceback

image

Steps to Reproduce

  1. Install neo-tree with image.nvim dependency
  2. Open neo-tree
  3. Open preview of any image

Expected Behavior

Rendered image in preview

Your Configuration

-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath, })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  "folke/tokyonight.nvim",
  -- add any other plugins here
}

local neotree_config = {
  "nvim-neo-tree/neo-tree.nvim",
  dependencies = { "MunifTanjim/nui.nvim", "nvim-tree/nvim-web-devicons", "nvim-lua/plenary.nvim", "3rd/image.nvim" },
  cmd = { "Neotree" },
  opts = {
    window = {
      mappings = {
        ["P"] = { "toggle_preview", config = { use_float = true, use_image_nvim = true } },
      }
    }
  },
}

table.insert(plugins, neotree_config)
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here
pysan3 commented 6 months ago

Could you double check if image.nvim itself indeed works but only fails with neo-tree?

https://github.com/3rd/image.nvim#try-it-out-with-a-minimal-setup

DamienPetrilli commented 3 weeks ago

I have the exact same issue on macOS. I did the minimal setup and it works. Yet Neotree previews doesn't :(

Screenshot 2024-08-17 at 11 08 17 AM Screenshot 2024-08-17 at 11 08 47 AM