Notifications preview not supported by extmarks #2899
Answered by
drowning-cat
Jun 29, 2026
Replies: 2 comments 6 replies
|
I'm not exactly sure what you're trying to achieve without a concrete example. According to ⎘ ref, vim.api.nvim_echo(chunks, false, { kind = 'list_cmd' }) |
3 replies
|
Here is a hacky way to solve the problem: vim.pack.add({
{ src = "https://github.com/MunifTanjim/nui.nvim" },
{ src = "https://github.com/folke/noice.nvim" },
{ src = "https://github.com/folke/snacks.nvim" },
})
require("noice").setup({})
local ctx_mock = {
notifier = {
get_render = function()
return function(buf, notif, _ctx)
vim.api.nvim_buf_set_lines(buf, 0, -1, true, vim.split(notif.msg, "\n"))
end
end,
},
}
require("snacks").setup({
notifier = {
enabled = true,
},
picker = {
sources = {
notifications = {
preview = function(ctx)
---@type snacks.notifier.Notif
local notif = ctx.picker:current().item
ctx.preview:reset()
-- ctx.preview:set_lines(vim.split(notif.msg, "\n"))
local ok = pcall(function()
local modifiable = vim.bo[ctx.buf].modifiable
vim.bo[ctx.buf].modifiable = true
notif.style(ctx.buf, notif, ctx_mock)
vim.bo[ctx.buf].modifiable = modifiable
end)
if not ok then
Snacks.picker.preview.preview(ctx)
end
end,
},
},
},
})
vim.keymap.set("n", "<F1>", function()
vim.cmd("Inspect")
end)
vim.keymap.set("n", "<F2>", function()
error("BUG!")
end)
vim.keymap.set("n", "<F3>", function()
Snacks.picker.notifications()
end) |
3 replies
Answer selected by
dagl1
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment






Here is a hacky way to solve the problem: