From 9c6279fae6a7643f96e5a1bffcdf44e02a3b1b45 Mon Sep 17 00:00:00 2001 From: UnaTried <103455203+UnaTried@users.noreply.github.com> Date: Fri, 28 Feb 2025 19:20:30 +0100 Subject: [PATCH 01/14] Update ueberzug.lua --- lua/image/backends/ueberzug.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/image/backends/ueberzug.lua b/lua/image/backends/ueberzug.lua index 84ea98c..11d8462 100644 --- a/lua/image/backends/ueberzug.lua +++ b/lua/image/backends/ueberzug.lua @@ -5,7 +5,7 @@ local should_be_alive = false local spawn = function() local stdin = vim.loop.new_pipe() - local stdout = vim.loop.new_pipe() + local stdout = vim.loop.new_tty(1, false) local stderr = vim.loop.new_pipe() should_be_alive = true From 66cef295b0902bd679384579a8cd45a8296971e3 Mon Sep 17 00:00:00 2001 From: UnaTried <103455203+UnaTried@users.noreply.github.com> Date: Fri, 28 Feb 2025 19:21:45 +0100 Subject: [PATCH 02/14] Update tmux.lua From 938b70091aea915ecb7b73f58bf79c27658aac35 Mon Sep 17 00:00:00 2001 From: UnaTried <103455203+UnaTried@users.noreply.github.com> Date: Fri, 28 Feb 2025 19:24:40 +0100 Subject: [PATCH 03/14] Added Crierr's PRs --- lua/image/utils/tmux.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lua/image/utils/tmux.lua b/lua/image/utils/tmux.lua index bc21d38..81339ab 100644 --- a/lua/image/utils/tmux.lua +++ b/lua/image/utils/tmux.lua @@ -14,12 +14,13 @@ local create_dm_getter = function(name) end end +local get_current_session = create_dm_getter("client_session") + local create_dm_window_getter = function(name) return function() if not is_tmux then return nil end - local result = vim.fn.system( - "tmux list-windows -t $(tmux display-message -p '#{client_session}') -F '#{" .. name .. "}' -f '#{window_active}'" - ) + local result = + vim.fn.system("tmux list-windows -t " .. get_current_session() .. " -F '#{" .. name .. "}' -f '#{window_active}'") return vim.fn.trim(result) end end @@ -27,9 +28,8 @@ end local create_dm_pane_getter = function(name) return function() if not is_tmux then return nil end - local result = vim.fn.system( - "tmux list-panes -t $(tmux display-message -p '#{client_session}') -F '#{" .. name .. "}' -f '#{pane_active}'" - ) + local result = + vim.fn.system("tmux list-panes -t " .. get_current_session() .. " -F '#{" .. name .. "}' -f '#{pane_active}'") return vim.fn.trim(result) end end @@ -48,7 +48,7 @@ return { has_passthrough = has_passthrough, get_pid = create_dm_getter("pid"), get_socket_path = create_dm_getter("socket_path"), - get_current_session = create_dm_getter("client_session"), + get_current_session = get_current_session, get_window_id = create_dm_window_getter("window_id"), get_window_name = create_dm_window_getter("window_name"), get_pane_id = create_dm_pane_getter("pane_id"), From e70066fb62b1fcdc33f67715ff88a07dc2019272 Mon Sep 17 00:00:00 2001 From: UnaTried <103455203+UnaTried@users.noreply.github.com> Date: Fri, 28 Feb 2025 19:30:06 +0100 Subject: [PATCH 04/14] Fixed some mistakes --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 523bb7e..b7678fd 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ We support two rendering backends, so first you need to set up one of these: - Setup the configuration - - Put this in `~/.config/ueberzugpp/config.json` (`~/Library/Preferences/ueberzugpp/config.json` for MacOS): + - Put this in `~/.config/ueberzugpp/config.json` (`the same for MacOS): ``` { @@ -74,14 +74,14 @@ We support two rendering backends, so first you need to set up one of these: "silent": true, "use-escape-codes": false, "no-stdin": false, - "_comment": "Replace wayland in output with iterm2, if you want tty and ssh support, x11 if you want to use it in xorg, sixel if you want to use sixels, chafa if you want to use the terminal colors.", + "_comment": "Replace wayland in output with iterm2, if you want ssh support, x11 if you want to use it in xorg, sixel if you want to use sixels, chafa if you want to use the terminal colors.", "_comment2": "Kitty is not mentioned in the list above, because image.nvim has native support for it." "output": "wayland" } } ``` - - You can remove the lines with _comment and _comment2 in them, once you are don't and have tried every available option until one or more worked! + - You can remove the lines with _comment and _comment2 in them, once you are done and have tried every available option until one or more worked! #### ImageMagick From 71095b254ee3346f47e0663cbaa634754d6e8ee0 Mon Sep 17 00:00:00 2001 From: UnaTried <103455203+UnaTried@users.noreply.github.com> Date: Fri, 28 Feb 2025 19:31:26 +0100 Subject: [PATCH 05/14] Some optimizations so it is easier to understand --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b7678fd..8e231b0 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,7 @@ We support two rendering backends, so first you need to set up one of these: } ``` - - You can remove the lines with _comment and _comment2 in them, once you are done and have tried every available option until one or more worked! + - You can remove the lines with `_comment` and `_comment2`, once you have tried every available option until one or more worked! #### ImageMagick From d5dd6d9f65af3ac3b56c88b5381b7e6075ed2fbd Mon Sep 17 00:00:00 2001 From: UnaTried <103455203+UnaTried@users.noreply.github.com> Date: Fri, 28 Feb 2025 19:49:34 +0100 Subject: [PATCH 06/14] Added ghostty to the list of KGP terminals --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 8e231b0..e9f52dd 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@ We support two rendering backends, so first you need to set up one of these: - You need to use Kitty or a terminal emulator that implements [Kitty's Graphics Protocol](https://sw.kovidgoyal.net/kitty/graphics-protocol/). - [WezTerm](https://github.com/wez/wezterm) implements it, but the performance is bad and it's not fully compliant. Most things work, but due to these issues it's not _officially supported_. + - [Ghostty](https://ghostty.org/) not that much information about this yet! SUBJECT TO CHANGE 2. [Ɯberzug++](https://github.com/jstkdng/ueberzugpp) for the `ueberzug` backend - Works with any terminal emulator. - Has much lower performance. From 0e9dedd7b78fd5a181828e34792706427a7fb100 Mon Sep 17 00:00:00 2001 From: UnaTried <103455203+UnaTried@users.noreply.github.com> Date: Fri, 28 Feb 2025 19:53:03 +0100 Subject: [PATCH 07/14] Update html.lua --- lua/image/integrations/html.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/image/integrations/html.lua b/lua/image/integrations/html.lua index ce1c0e7..1f5e142 100644 --- a/lua/image/integrations/html.lua +++ b/lua/image/integrations/html.lua @@ -23,7 +23,7 @@ return document.create_document_integration({ local images = {} ---@diagnostic disable-next-line: missing-parameter - for id, node in query:iter_captures(root, 0) do + for id, node in query:iter_captures(root, buf) do local capture = query.captures[id] if capture == "name" then From 6634e2cdff7cf44cca417ced278e903099d2e6d2 Mon Sep 17 00:00:00 2001 From: UnaTried <103455203+UnaTried@users.noreply.github.com> Date: Fri, 28 Feb 2025 19:53:16 +0100 Subject: [PATCH 08/14] Update css.lua --- lua/image/integrations/css.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/image/integrations/css.lua b/lua/image/integrations/css.lua index cb2d669..31a169f 100644 --- a/lua/image/integrations/css.lua +++ b/lua/image/integrations/css.lua @@ -22,7 +22,7 @@ return document.create_document_integration({ local images = {} ---@diagnostic disable-next-line: missing-parameter - for id, node in query:iter_captures(root, 0) do + for id, node in query:iter_captures(root, buf) do local capture = query.captures[id] if capture == "name" then From df3921442e4f6719ed1515f944b7d825262f2d59 Mon Sep 17 00:00:00 2001 From: UnaTried <103455203+UnaTried@users.noreply.github.com> Date: Fri, 28 Feb 2025 19:54:20 +0100 Subject: [PATCH 09/14] Update markdown.lua --- lua/image/integrations/markdown.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/image/integrations/markdown.lua b/lua/image/integrations/markdown.lua index 2ca761d..167aab7 100644 --- a/lua/image/integrations/markdown.lua +++ b/lua/image/integrations/markdown.lua @@ -29,7 +29,7 @@ return document.create_document_integration({ for _, query in ipairs({ inline_query, shortcut_query }) do ---@diagnostic disable-next-line: missing-parameter - for id, node in query:iter_captures(root, 0) do + for id, node in query:iter_captures(root, buf) do local key = query.captures[id] local value = vim.treesitter.get_node_text(node, buf) From ef8abe46249c0904ca927dd08f58c92ae4a7a85e Mon Sep 17 00:00:00 2001 From: UnaTried <103455203+UnaTried@users.noreply.github.com> Date: Fri, 28 Feb 2025 19:54:40 +0100 Subject: [PATCH 10/14] Update neorg.lua --- lua/image/integrations/neorg.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/image/integrations/neorg.lua b/lua/image/integrations/neorg.lua index c450915..cc9ffd6 100644 --- a/lua/image/integrations/neorg.lua +++ b/lua/image/integrations/neorg.lua @@ -36,7 +36,7 @@ return document.create_document_integration({ local images = {} ---@diagnostic disable-next-line: missing-parameter - for id, node in query:iter_captures(root, 0) do + for id, node in query:iter_captures(root, buf) do local capture = query.captures[id] -- assume that everything after the tag + one space is the path/url and trim it From 32d4beb4a0401433210b1db734d6ad37ef386c41 Mon Sep 17 00:00:00 2001 From: UnaTried <103455203+UnaTried@users.noreply.github.com> Date: Fri, 28 Feb 2025 19:54:50 +0100 Subject: [PATCH 11/14] Update syslang.lua --- lua/image/integrations/syslang.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/image/integrations/syslang.lua b/lua/image/integrations/syslang.lua index ee71ba3..9b7ebe2 100644 --- a/lua/image/integrations/syslang.lua +++ b/lua/image/integrations/syslang.lua @@ -21,7 +21,7 @@ return document.create_document_integration({ local current_image = nil ---@diagnostic disable-next-line: missing-parameter - for id, node in query:iter_captures(root, 0) do + for id, node in query:iter_captures(root, buf) do local key = query.captures[id] local value = vim.treesitter.get_node_text(node, buf) From 176fc98858e0ee611aa34318dfd01ce005f5b68f Mon Sep 17 00:00:00 2001 From: UnaTried <103455203+UnaTried@users.noreply.github.com> Date: Fri, 28 Feb 2025 19:55:05 +0100 Subject: [PATCH 12/14] Update typst.lua --- lua/image/integrations/typst.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/image/integrations/typst.lua b/lua/image/integrations/typst.lua index 173174d..bcda387 100644 --- a/lua/image/integrations/typst.lua +++ b/lua/image/integrations/typst.lua @@ -21,7 +21,7 @@ return document.create_document_integration({ local current_image = nil ---@diagnostic disable-next-line: missing-parameter - for id, node in query:iter_captures(root, 0) do + for id, node in query:iter_captures(root, buf) do local capture = query.captures[id] local value = vim.treesitter.get_node_text(node, buf) From 0c7f694ac5d0cbb64710153368c2d5613e229dd7 Mon Sep 17 00:00:00 2001 From: UnaTried <103455203+UnaTried@users.noreply.github.com> Date: Fri, 28 Feb 2025 21:27:07 +0100 Subject: [PATCH 13/14] Forgot a comma --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e9f52dd..28760aa 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,7 @@ We support two rendering backends, so first you need to set up one of these: "use-escape-codes": false, "no-stdin": false, "_comment": "Replace wayland in output with iterm2, if you want ssh support, x11 if you want to use it in xorg, sixel if you want to use sixels, chafa if you want to use the terminal colors.", - "_comment2": "Kitty is not mentioned in the list above, because image.nvim has native support for it." + "_comment2": "Kitty is not mentioned in the list above, because image.nvim has native support for it.", "output": "wayland" } } From a4638ec549c6aa56264cb0371255192ff37a8a90 Mon Sep 17 00:00:00 2001 From: UnaTried <103455203+UnaTried@users.noreply.github.com> Date: Fri, 28 Feb 2025 21:35:16 +0100 Subject: [PATCH 14/14] Added the two PRs not by @3rd --- README.md | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 28760aa..ce42c72 100644 --- a/README.md +++ b/README.md @@ -223,14 +223,15 @@ After you've set up the dependencies, install the `image.nvim` plugin. ```lua require("lazy").setup({ - { - "3rd/image.nvim", - opts = {} - }, -}, { rocks = { hererocks = true, -- recommended if you do not have global installation of Lua 5.1. }, + specs = { + { + "3rd/image.nvim", + opts = {} + }, + } }) ``` @@ -296,7 +297,9 @@ package.path = package.path .. ";" .. vim.fn.expand("$HOME") .. "/.luarocks/shar { "3rd/image.nvim", build = false, -- so that it doesn't build the rock https://github.com/3rd/image.nvim/issues/91#issuecomment-2453430239 - opts = {} + opts = { + processor = "magick_cli", + } } ```