image.nvim seems to have an unexpected effect on messages events kinds. It especially happens when rendering images or when the window_overlap_clear_enabled option is true. msg_show events with empty kind turn into echo kind (as described in the ui-messages api). I was able to reproduce consistently this behaviour with this init.lua file :
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"--branch=stable",
"https://github.com/folke/lazy.nvim.git",
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup({
{
"3rd/image.nvim",
dependencies = {
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
config = function()
require("nvim-treesitter.configs").setup({
ensure_installed = { "markdown", "lua" },
highlight = { enable = true },
})
end,
},
{ "vhyrro/luarocks.nvim", config = true, opts = { rocks = { "magick" } } },
},
opts = {
backend = "kitty",
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,
kitty_method = "normal",
window_overlap_clear_enabled = true, -- happens all the time when this is true
},
},
})
local namespace = vim.api.nvim_create_namespace("log")
local log = {}
local function attach()
vim.ui_attach(namespace, { ext_messages = true }, function(event, ...)
if event == "msg_show" then
local kind, content, _ = ...
if kind == "" or kind == "echo" then
table.insert(log, "K: " .. kind .. " -C: " .. vim.inspect(content))
return true
end
end
return false
end)
end
attach()
vim.api.nvim_create_user_command("Log", function()
vim.ui_detach(namespace)
local mes = table.concat(log, "\n")
print(mes)
end, {})
-- This is just to view the cmd as you write it
vim.keymap.set("n", ":", "q:<cmd>startinsert<CR>", {})
Hitting Ctrl-c a bunch of times before calling Log should suffice to show the behaviour. Doing it without image.nvim being setup only produces empty kind "Type :qa ..." messages.
I don't know if this is the place to post about that but I was not able to reproduce without image.nvim.
image.nvim seems to have an unexpected effect on messages events kinds. It especially happens when rendering images or when the window_overlap_clear_enabled option is true. msg_show events with empty kind turn into echo kind (as described in the ui-messages api). I was able to reproduce consistently this behaviour with this init.lua file :
Hitting Ctrl-c a bunch of times before calling Log should suffice to show the behaviour. Doing it without image.nvim being setup only produces empty kind "Type :qa ..." messages.
I don't know if this is the place to post about that but I was not able to reproduce without image.nvim.