Skip to content

Instantly share code, notes, and snippets.

@pachun
Created August 13, 2024 11:39
Show Gist options
  • Save pachun/ce0fa42a644d4e80800a96528e1b2015 to your computer and use it in GitHub Desktop.
Save pachun/ce0fa42a644d4e80800a96528e1b2015 to your computer and use it in GitHub Desktop.
-- Change the Diagnostic symbols in the sign column (gutter)
-- (not in youtube nvim video)
local signs = { Error = "", Warn = "", Hint = "󰠠", Info = "" }
for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon .. " ", texthl = hl, numhl = "" })
end
-- Change the diagnostic symbols by the error message
vim.diagnostic.config({
virtual_text = {
format = function(diagnostic)
local icons = {
[vim.diagnostic.severity.ERROR] = signs.Error,
[vim.diagnostic.severity.WARN] = signs.Warn,
[vim.diagnostic.severity.INFO] = signs.Info,
[vim.diagnostic.severity.HINT] = signs.Hint,
}
return string.format("%s %s", icons[diagnostic.severity], diagnostic.message)
end,
prefix = "",
spacing = 2,
},
signs = true,
update_in_insert = false,
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment