added error highlighting.
This commit is contained in:
46
init.lua
46
init.lua
@@ -54,17 +54,59 @@ opt.mouse = ""
|
|||||||
opt.shortmess:append("atI")
|
opt.shortmess:append("atI")
|
||||||
opt.hidden = true
|
opt.hidden = true
|
||||||
opt.termguicolors = true -- Important for modern LSPs/UI
|
opt.termguicolors = true -- Important for modern LSPs/UI
|
||||||
|
opt.updatetime = 300 -- Faster response for diagnostics
|
||||||
|
|
||||||
-- =============================================================================
|
-- =============================================================================
|
||||||
-- 4. DIAGNOSTICS (Error display)
|
-- 4. DIAGNOSTICS (Error display)
|
||||||
-- =============================================================================
|
-- =============================================================================
|
||||||
vim.diagnostic.config({
|
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
|
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,
|
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)
|
-- 5. KEYMAPS (Leader: Space)
|
||||||
-- =============================================================================
|
-- =============================================================================
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ end
|
|||||||
-- The main menu
|
-- The main menu
|
||||||
function M.open()
|
function M.open()
|
||||||
local lines = {
|
local lines = {
|
||||||
" Mono VIM - 0.17",
|
" Mono VIM - 0.18",
|
||||||
"========================",
|
"========================",
|
||||||
"",
|
"",
|
||||||
" [n] New File",
|
" [n] New File",
|
||||||
|
|||||||
Reference in New Issue
Block a user