image.nvim icon indicating copy to clipboard operation
image.nvim copied to clipboard

Imagen is not rendered anymore

Open jjmonsalveg opened this issue 1 year ago • 12 comments

nvim --version                                                                                                                                                                                                                                                                       ✹1b9b461 ‹ruby-3.4.2›
NVIM v0.11.1
Build type: Release
LuaJIT 2.1.1744318430
Run "nvim -V1 -v" for more info

My config

return {
  "3rd/image.nvim",
  opts = {},
  config = function()
    require("image").setup({
      kitty_method = "normal",
      backend = "kitty",
      processor = "magick_rock", -- or "magick_cli"
      integrations = {
        markdown = {
          enabled = true,
          clear_in_insert_mode = false,
          download_remote_images = true,
          only_render_image_at_cursor = true,
          floating_windows = true,               -- if true, images will be rendered in floating markdown windows
          filetypes = { "markdown", "vimwiki" }, -- markdown extensions (ie. quarto) can go here
        },
        neorg = {
          enabled = true,
          filetypes = { "norg" },
        },
        typst = {
          enabled = true,
          filetypes = { "typst" },
        },
        html = {
          enabled = false,
        },
        css = {
          enabled = false,
        },
      },
      max_width = nil,
      max_height = nil,
      max_width_window_percentage = nil,
      max_height_window_percentage = 50,
      window_overlap_clear_enabled = true,                                                -- toggles images when windows are overlapped
      window_overlap_clear_ft_ignore = { "cmp_menu", "cmp_docs", "snacks_notif", "scrollview", "scrollview_sign" },
      editor_only_render_when_focused = true,                                             -- auto show/hide images when the editor gains/looses focus
      tmux_show_only_in_active_window = true,                                             -- auto show/hide images in the correct Tmux window (needs visual-activity off)
      hijack_file_patterns = { "*.png", "*.jpg", "*.jpeg", "*.gif", "*.webp", "*.avif" }, -- render image files as images when opened
    })
  end,
}

lazy nvim

require("lazy").setup({
  rocks = {
    hererocks = true, -- recommended if you do not have global installation of Lua 5.1.
  },
  spec = {
    { import = "config.plugins" },
  },
  change_detection = {
    -- automatically check for config file changes and reload the ui
    enabled = false,
    notify = false, -- get a notification when changes are found
  },
})

This was working fine, however, at some point it stopped working and I decided to run a bisect, I found the first bad commit was this one

commit aeef05e3d8bdcc7a9adbb76c16def5bed36167c7
Author: Jonathan Monsalve <[email protected]>
Date:   Fri Apr 25 15:11:34 2025 -0600

    chore(nmvi.lazy-lock): Update dependencies

diff --git a/nvim-lua/.config/nvim/lazy-lock.json b/nvim-lua/.config/nvim/lazy-lock.json
index 227b147..2284fce 100644
--- a/nvim-lua/.config/nvim/lazy-lock.json
+++ b/nvim-lua/.config/nvim/lazy-lock.json
@@ -1,40 +1,40 @@
 {
-  "CopilotChat.nvim": { "branch": "main", "commit": "634aa58117a9b70b3f08a0b150f11afd64f1c0eb" },
+  "CopilotChat.nvim": { "branch": "main", "commit": "75653259442a8eb895abfc70d7064e07aeb7134c" },
   "LazyVim": { "branch": "main", "commit": "ec5981dfb1222c3bf246d9bcaa713d5cfa486fbd" },
   "LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" },
   "alpha-nvim": { "branch": "main", "commit": "de72250e054e5e691b9736ee30db72c65d560771" },
-  "blink-ripgrep.nvim": { "branch": "main", "commit": "56084d1f45c8621d23d4bac724c2dc50b1eb75db" },
+  "blink-ripgrep.nvim": { "branch": "main", "commit": "89c4d158bc6d6ca03b4059452f2f9ffaa850db8a" },
   "blink.cmp": { "branch": "main", "commit": "485c03400608cb6534bbf84da8c1c471fc4808c0" },
-  "copilot.vim": { "branch": "release", "commit": "8d1e0f86d8aaa64070c080589bc2a516beb4024f" },
-  "friendly-snippets": { "branch": "main", "commit": "31f2a2657b6261724313281fe0d8ba6f43f4a4fa" },
-  "fzf": { "branch": "master", "commit": "e491770f1c5f50cc969ff58228cd29a7cfa76663" },
+  "copilot.vim": { "branch": "release", "commit": "7167958954532a0a1b83f2db2f591b43aebff44c" },
+  "friendly-snippets": { "branch": "main", "commit": "fc8f183479a472df60aa86f00e295462f2308178" },
+  "fzf": { "branch": "master", "commit": "d2c662e54f7d5d011d42915c543c265c0f555d97" },
   "fzf.vim": { "branch": "master", "commit": "3cb44a8ba588e1ada409af495bdc6a4d2d37d5da" },
   "gitlinker.nvim": { "branch": "master", "commit": "cc59f732f3d043b626c8702cb725c82e54d35c25" },
-  "gitsigns.nvim": { "branch": "main", "commit": "02eafb1273afec94447f66d1a43fc5e477c2ab8a" },
-  "gruvbox": { "branch": "master", "commit": "f1ecde848f0cdba877acb0c740320568252cc482" },
+  "gitsigns.nvim": { "branch": "main", "commit": "140ac646db125904e456e42ab8b538d28f9607d7" },
+  "gruvbox": { "branch": "master", "commit": "697c00291db857ca0af00ec154e5bd514a79191f" },
   "harpoon": { "branch": "harpoon2", "commit": "ed1f853847ffd04b2b61c314865665e1dadf22c7" },
   "hererocks": { "branch": "master", "commit": "c9c5444dea1e07e005484014a8231aa667be30b6" },
-  "image.nvim": { "branch": "master", "commit": "2e2d28b7734b5efdfc1219f4da8a46c761587bc2" },
+  "image.nvim": { "branch": "master", "commit": "4c51d6202628b3b51e368152c053c3fb5c5f76f2" },
   "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
   "lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" },
-  "lualine.nvim": { "branch": "master", "commit": "86fe39534b7da729a1ac56c0466e76f2c663dc42" },
+  "lualine.nvim": { "branch": "master", "commit": "15884cee63a8c205334ab13ab1c891cd4d27101a" },
   "mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" },
   "mason-tool-installer.nvim": { "branch": "main", "commit": "1255518cb067e038a4755f5cb3e980f79b6ab89c" },
   "mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" },
   "molten-nvim": { "branch": "main", "commit": "a286aa914d9a154bc359131aab788b5a077a5a99" },
-  "neo-tree.nvim": { "branch": "v3.x", "commit": "9b5d67119c46e3262ffe1508fe6d8540b79ad75d" },
-  "none-ls-extras.nvim": { "branch": "main", "commit": "1214d729e3408470a7b7a428415a395e5389c13c" },
-  "none-ls.nvim": { "branch": "main", "commit": "fb50cf17e926a037c9f8d96d8db29ddbd04965d4" },
-  "nui.nvim": { "branch": "main", "commit": "8d3bce9764e627b62b07424e0df77f680d47ffdb" },
+  "neo-tree.nvim": { "branch": "v3.x", "commit": "1ef260eb4f54515fe121a2267b477efb054d108a" },
+  "none-ls-extras.nvim": { "branch": "main", "commit": "80dfc30b674c45ad892726f656440cc9e69b82e3" },
+  "none-ls.nvim": { "branch": "main", "commit": "f2c4f661fb6319fb4d5bcbed62601698791a6d83" },
+  "nui.nvim": { "branch": "main", "commit": "8d5b0b568517935d3c84f257f272ef004d9f5a59" },
   "nvim-autopairs": { "branch": "master", "commit": "4d74e75913832866aa7de35e4202463ddf6efd1b" },
   "nvim-dap": { "branch": "master", "commit": "98bf130702eaafad8567c0e3ea1171c2552d58bb" },
-  "nvim-dap-ui": { "branch": "master", "commit": "881a69e25bd6658864fab47450025490b74be878" },
-  "nvim-lspconfig": { "branch": "master", "commit": "32b6a6449aaba11461fffbb596dd6310af79eea4" },
+  "nvim-dap-ui": { "branch": "master", "commit": "73a26abf4941aa27da59820fd6b028ebcdbcf932" },
+  "nvim-lspconfig": { "branch": "master", "commit": "f875e581b67fa21417cc6836fe68273e42b6b1b1" },
   "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
   "nvim-treesitter": { "branch": "master", "commit": "684eeac91ed8e297685a97ef70031d19ac1de25a" },
   "nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" },
-  "nvim-web-devicons": { "branch": "master", "commit": "c90dee4e930ab9f49fa6d77f289bff335b49e972" },
-  "oil.nvim": { "branch": "master", "commit": "302bbaceeafc690e6419e0c8296e804d60cb9446" },
+  "nvim-web-devicons": { "branch": "master", "commit": "50b5b06bff13a9b4eab946de7c7033649a6618a1" },
+  "oil.nvim": { "branch": "master", "commit": "685cdb4ffa74473d75a1b97451f8654ceeab0f4a" },
   "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
   "refactoring.nvim": { "branch": "master", "commit": "2be7ea3f10b7e59658f5abf6dffc50b5d61964d6" },
   "remote-nvim.nvim": { "branch": "main", "commit": "66fc20fd259401c7bb6ac5189ecb6283c2eb65d2" },
@@ -58,5 +58,5 @@
   "vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" },
   "vim-test": { "branch": "master", "commit": "b0c3e13249699a522c8b472ff79eff40d2935476" },
   "vim-visual-multi": { "branch": "master", "commit": "a6975e7c1ee157615bbc80fc25e4392f71c344d4" },
-  "vimtex": { "branch": "master", "commit": "292ddf8063bc725b027f69d3b42086d221daab1d" }
+  "vimtex": { "branch": "master", "commit": "4fbf861dbe91f0ea6cb0adedcdf3e6551fe395da" }
 }

Let's highlight what concerns to this repository:

-  "image.nvim": { "branch": "master", "commit": "2e2d28b7734b5efdfc1219f4da8a46c761587bc2" },
+  "image.nvim": { "branch": "master", "commit": "4c51d6202628b3b51e368152c053c3fb5c5f76f2" },

So, it seems that this change https://github.com/3rd/image.nvim/pull/284/files. Is the problematic change. Is it a bug, or is it something I have to change in my config?

Maybe it has to do with this line?

vim.bo[buf].filetype = "image_nvim"

Something might be happening in these lines that later breaks the render.

Thank you in advance.

jjmonsalveg avatar Apr 28 '25 19:04 jjmonsalveg

+1 i shouldve look sooner if there is an open issue b4 trying to fix it 😅

aaronedev avatar May 03 '25 05:05 aaronedev

Same for me, after upgrading to nvim 0.11, it doesn't hijack the image buffers anymore.

carlos-algms avatar May 09 '25 16:05 carlos-algms

Any temporary solution?

joaoptpsa avatar May 13 '25 14:05 joaoptpsa

same problem here any updates?

AhmedEhab-SG avatar May 14 '25 14:05 AhmedEhab-SG

@joaoptpsa U can use commit 21909e3eb03bc738cce497f45602bf157b396672 until it gets fixed

viceav avatar May 15 '25 07:05 viceav

Thank you for responding, for reference this is the way to do it with lazy.nvim:

    commit = "21909e3eb03bc738cce497f45602bf157b396672",

This did not work for me:

   version = "21909e3eb03bc738cce497f45602bf157b396672",

joaoptpsa avatar May 15 '25 07:05 joaoptpsa

@joaoptpsa Did u run Lazy restore after setting the commit?

viceav avatar May 15 '25 14:05 viceav

@viceav I uninstalled (x) and installed (i) via :Lazy.

joaoptpsa avatar May 16 '25 06:05 joaoptpsa

@joaoptpsa Did u run Lazy restore after setting the commit?

u have to otherwise it wont work? or u remove it as @joaoptpsa pointed out:)

aaronedev avatar May 16 '25 10:05 aaronedev

@aaronedev Yeah, if u remove and install you'll get the latest commit. If u want to update to the version in the lockfile (lazy-lock.json) you have to run :Lazy restore

Image

viceav avatar May 16 '25 20:05 viceav

It seems that the latest version put the image on top of the text that have the image in the latest version, which make any image on the first line not render properly.

Image

In the commit = "21909e3eb03bc738cce497f45602bf157b396672", however, the image is being rendered below the text, which make the image on the first line render properly.

Image

So, that might be why the image stop rendering.

Chayanon-Ninyawee avatar Jun 20 '25 17:06 Chayanon-Ninyawee

Confirm it works after changing the commit to: commit = "21909e3eb03bc738cce497f45602bf157b396672",

Kiruel avatar Jul 08 '25 14:07 Kiruel