3rd / image.nvim

🖼️ Bringing images to Neovim.
MIT License
812 stars 35 forks source link

No image showing, but the space is there. #99

Closed neuromaancer closed 5 months ago

neuromaancer commented 6 months ago

I finally successfully install the imagemagick and ueberzugpp. It seems no errors and warnings, but it doesn't show any image in my markdown file. However, it leaves the space for the image! I am sure that ueberzugpp is working because I have yazi installed, it uses ueberzugpp, and it works well. I don't know whether it is a bug or something wrong with my side.

neuromaancer commented 6 months ago

There is a screenshot for this:

image

There should be an image at line 3, but no picture is shown, but the space is there.

3rd commented 6 months ago

Has to be something in your setup, do you have the latest version of ueberzugpp?

neuromaancer commented 6 months ago

I installed ueberzugpp via homebrew and it is the lastest version. My setting is:

package.path = package.path .. ";" .. vim.fn.expand("$HOME") .. "/.luarocks/share/lua/5.1/?/init.lua;"
package.path = package.path .. ";" .. vim.fn.expand("$HOME") .. "/.luarocks/share/lua/5.1/?.lua;"

return {
    "3rd/image.nvim",
    ft = "markdown",
    opts = {
        backend = "ueberzug",
        integrations = {
            markdown = {
                enabled = true,
                clear_in_insert_mode = false,
                download_remote_images = true,
                only_render_image_at_cursor = false,
                filetypes = { "markdown", "vimwiki" }, -- markdown extensions (ie. quarto) can go here
            },
            neorg = {
                enabled = true,
                clear_in_insert_mode = false,
                download_remote_images = true,
                only_render_image_at_cursor = false,
                filetypes = { "norg" },
            },
        },
        max_width = nil,
        max_height = nil,
        max_width_window_percentage = nil,
        max_height_window_percentage = 50,
        window_overlap_clear_enabled = false, -- toggles images when windows are overlapped
        window_overlap_clear_ft_ignore = { "cmp_menu", "cmp_docs", "" },
        editor_only_render_when_focused = false, -- auto show/hide images when the editor gains/looses focus
        tmux_show_only_in_active_window = false, -- auto show/hide images in the correct Tmux window (needs visual-activity off)
        hijack_file_patterns = { "*.png", "*.jpg", "*.jpeg", "*.gif", "*.webp" }, -- render image files as images when opened
    },
}
Williepedia commented 5 months ago

I am experiencing a similar issue with both the kitty and ueberzug backends.

However, with some testing with the minimal-setup.lua file, I realized this only occurs in a (poetry) virtual environment. Are there any steps that need to be taken to make the plugin compatible with virtual environments?

Edit: This appears to be a poetry issue for me. Just tried it with venv and it works as advertised.

3rd commented 5 months ago

Yeah, not sure what's going wrong, these are edge cases that need debugging where the issue happens. @neuromaancer afraid I can't help, you can try debugging what's going, it has to be something specific to your setup. The first rewrite of the plugin is in-progress, and we'll have a logging & troubleshooting layer soon.

soumilgurjar commented 4 weeks ago

I am facing the same issue when using the kitty backend on a M1 Mac, but creating the project virtual environment using pipenv. Everything works well if the virtual environment is created using venv (python -m venv .venv). Does anyone know what the issue could be for pipenv / poetry virtual environments?

marty-oehme commented 3 weeks ago

Same problem here, and I am also not sure why it specifically does not work with those two.

However, if you change your python host program and path manually instead to prepend the correct folders it does work fine again:

local p = vim.env.PATH or ""
vim.g["python3_host_prog"] = vim.fn.expand("<YOUR-PYTHON-BIN-HERE>")
vim.env.PATH = "<YOUR-VENV-PATH-HERE> .. "/bin:" .. p

Since this is (effectively) all the activation scripts are doing, it must be some interaction with the script on poetry's end. If pipenv has the same issues perhaps it could be possible to compare activation scripts to find the culprit.

3rd commented 3 weeks ago

This is super weird, as the plugin itself doesn't use anything python-related, it could be a deeper bug :eyes: