fix(nvim): diagnostic sign
This commit is contained in:
@@ -4,15 +4,22 @@ local opt = require("core.globals").keymap_opt
|
|||||||
vim.keymap.set("n", "K", vim.lsp.buf.hover, opt)
|
vim.keymap.set("n", "K", vim.lsp.buf.hover, opt)
|
||||||
vim.keymap.set("n", "<leader>lR", vim.lsp.buf.rename, opt)
|
vim.keymap.set("n", "<leader>lR", vim.lsp.buf.rename, opt)
|
||||||
|
|
||||||
local icons = { Error = " ", Warn = " ", Hint = " ", Info = " " }
|
local icons = { }
|
||||||
local signs = {}
|
local sev = vim.diagnostic.severity
|
||||||
|
local signs = {
|
||||||
|
[sev.ERROR] = " ",
|
||||||
|
[sev.WARN] = " ",
|
||||||
|
[sev.HINT] = " ",
|
||||||
|
[sev.INFO] = " "
|
||||||
|
}
|
||||||
for type, icon in pairs(icons) do
|
for type, icon in pairs(icons) do
|
||||||
local hl = "DiagnosticSign" .. type
|
local hl = vim.diagnostic.severity[type]
|
||||||
signs[hl] = { text = icon, texthl = hl, numhl = hl }
|
signs[hl] = icon
|
||||||
end
|
end
|
||||||
vim.diagnostic.config({
|
vim.diagnostic.config({
|
||||||
virtual_text = { spacing = 4, prefix = "●" },
|
signs = {
|
||||||
signs = signs,
|
text = signs
|
||||||
|
},
|
||||||
underline = true,
|
underline = true,
|
||||||
update_in_insert = true,
|
update_in_insert = true,
|
||||||
severity_sort = true,
|
severity_sort = true,
|
||||||
@@ -27,6 +34,8 @@ local diag_config1 = {
|
|||||||
severity = {
|
severity = {
|
||||||
max = vim.diagnostic.severity.WARN,
|
max = vim.diagnostic.severity.WARN,
|
||||||
},
|
},
|
||||||
|
spacing = 4,
|
||||||
|
prefix = "●"
|
||||||
},
|
},
|
||||||
virtual_lines = {
|
virtual_lines = {
|
||||||
severity = {
|
severity = {
|
||||||
@@ -35,7 +44,7 @@ local diag_config1 = {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
local diag_config2 = {
|
local diag_config2 = {
|
||||||
virtual_text = true,
|
virtual_text = { spacing = 4, prefix = "●" },
|
||||||
virtual_lines = false,
|
virtual_lines = false,
|
||||||
}
|
}
|
||||||
vim.diagnostic.config(diag_config1)
|
vim.diagnostic.config(diag_config1)
|
||||||
|
|||||||
Reference in New Issue
Block a user