Skip to content

Instantly share code, notes, and snippets.

@lina-bh
Created January 14, 2026 12:00
Show Gist options
  • Select an option

  • Save lina-bh/65a3ee38b3c17ead9e7be7b7fc215850 to your computer and use it in GitHub Desktop.

Select an option

Save lina-bh/65a3ee38b3c17ead9e7be7b7fc215850 to your computer and use it in GitHub Desktop.
vim.api.nvim_create_autocmd("CursorHold", {
callback = function()
local lnum, col = unpack(vim.api.nvim_win_get_cursor(0))
local diagnostics = vim.diagnostic.get(0, { lnum = lnum - 1 })
if #diagnostics > 0 then
vim.api.nvim_echo({
{
vim
.iter(diagnostics)
:filter(function(d)
return col >= d.col and col < d.end_col
end)
:map(function(d)
return d.message
end)
:join("\n"),
"WarningMsg",
},
}, false, {})
end
end,
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment