feat(image): make manual hover work correctly

This commit is contained in:
Folke Lemaitre 2025-02-15 22:09:52 +01:00
parent 537bd2e7e7
commit 942cb9291e
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040

View file

@ -221,6 +221,11 @@ function M.hover()
buf = current_buf,
img = Snacks.image.placement.new(win.buf, img.src, o),
}
vim.api.nvim_create_autocmd({ "BufWritePost", "CursorMoved", "ModeChanged", "BufLeave" }, {
buffer = current_buf,
once = true,
callback = M.hover,
})
end
---@param buf number
@ -279,7 +284,7 @@ function M.attach(buf)
callback = vim.schedule_wrap(update),
})
else
vim.api.nvim_create_autocmd({ "BufWritePost", "CursorMoved", "ModeChanged", "BufLeave" }, {
vim.api.nvim_create_autocmd({ "CursorMoved" }, {
group = group,
buffer = buf,
callback = vim.schedule_wrap(update),