added error highlighting.

This commit is contained in:
2026-04-08 12:05:46 +02:00
parent 9d279070f4
commit 91276a8a6f
2 changed files with 45 additions and 3 deletions

View File

@@ -54,17 +54,59 @@ opt.mouse = ""
opt.shortmess:append("atI")
opt.hidden = true
opt.termguicolors = true -- Important for modern LSPs/UI
opt.updatetime = 300 -- Faster response for diagnostics
-- =============================================================================
-- 4. DIAGNOSTICS (Error display)
-- =============================================================================
vim.diagnostic.config({
virtual_text = false, -- No text noise in the line
virtual_text = {
prefix = "", -- Subtle dot for error messages
},
underline = true, -- Errors are underlined
signs = false, -- No icons on the edge (less noise)
signs = true, -- Enable icons in the gutter
update_in_insert = false,
severity_sort = true,
})
-- Show error message in a floating window on hover
vim.api.nvim_create_autocmd("CursorHold", {
callback = function()
vim.diagnostic.open_float(nil, { focusable = false, border = "rounded" })
end,
})
-- Custom icons for diagnostics
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
-- =============================================================================
-- 4.5 TREESITTER (Syntax & Error Highlighting)
-- =============================================================================
vim.schedule(function()
local ok_ts, ts = pcall(require, "nvim-treesitter.configs")
if ok_ts then
ts.setup({
ensure_installed = { "lua", "python", "rust" },
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
},
})
end
end)
-- =============================================================================
-- 4.6 HIGHLIGHTS (Visibility)
-- =============================================================================
vim.api.nvim_set_hl(0, "DiagnosticUnderlineError", { undercurl = true, sp = "red", bold = true })
vim.api.nvim_set_hl(0, "DiagnosticUnderlineWarn", { undercurl = true, sp = "orange" })
vim.api.nvim_set_hl(0, "DiagnosticError", { fg = "red" })
vim.api.nvim_set_hl(0, "DiagnosticWarn", { fg = "orange" })
-- =============================================================================
-- 5. KEYMAPS (Leader: Space)
-- =============================================================================

View File

@@ -45,7 +45,7 @@ end
-- The main menu
function M.open()
local lines = {
" Mono VIM - 0.17",
" Mono VIM - 0.18",
"========================",
"",
" [n] New File",