From f1c92c0ec4ba2e6420e7969a1d2bc75e783d0db8 Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Sat, 6 Dec 2025 06:49:10 +0100 Subject: [PATCH] nvim/lua/user/options.lua: configure diagnostic float window --- nvim/lua/user/options.lua | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/nvim/lua/user/options.lua b/nvim/lua/user/options.lua index fbb7133..9eccfbc 100644 --- a/nvim/lua/user/options.lua +++ b/nvim/lua/user/options.lua @@ -85,7 +85,6 @@ vim.o.fillchars = string.format([[eob: ,fold: ,foldopen:%s,foldsep:%s,foldclose: vim.o.spell = true vim.o.spelllang = 'en_us' - vim.diagnostic.config({ virtual_text = false, severity_sort = true, @@ -98,11 +97,25 @@ vim.diagnostic.config({ [vim.diagnostic.severity.HINT] = icons.diagnostics.hint }, }, + float = { ---@diagnostic disable-next-line: assign-type-mismatch - border = { " " }, - header = "", - source = true, + border = 'none', + header = '', + source = false, + + prefix = function (diagnostic, _, _) + local hl = { + [vim.diagnostic.severity.ERROR] = "DiagnosticError", + [vim.diagnostic.severity.WARN] = "DiagnosticWarn", + [vim.diagnostic.severity.INFO] = "DiagnosticInfo", + [vim.diagnostic.severity.HINT] = "DiagnosticHint" + } + return "▊ ", hl[diagnostic.severity] + end, + suffix = function (diagnostic, _, _) + return " " .. diagnostic.source .. " ", "TextMute" + end, } })