Created
August 13, 2024 11:39
-
-
Save pachun/ce0fa42a644d4e80800a96528e1b2015 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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