Configure diagnostics

Set up diagnostics
This commit is contained in:
Robert Morrison 2022-07-25 19:55:30 +01:00
parent e3493b19c3
commit 3fa871ff34
Signed by: robert
GPG Key ID: 73E012EB3F4EC696

View File

@ -0,0 +1,26 @@
vim.diagnostic.config({
virtual_text = true,
signs = true,
underline = true,
update_in_insert = true,
severity_sort = false
}
)
-- This makes the Diagnostic Sigms look prettier
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 = hl })
end
-- This autocommand causes diagnostic info to appear where the cursor is hovering.
-- This is exceptionally useful when you have multiple issues per line
local gr = vim.api.nvim_create_augroup("Diagnostic_hover",{clear = true})
vim.api.nvim_create_autocmd("CursorHold",{
pattern = {"*"},
callback = function ()
vim.diagnostic.open_float(nil, {focus=false, scope="cursor"})
end,
group = gr
}
)