dev: automated commit - 2025-12-23 14:01:36
This commit is contained in:
parent
5c82cd5345
commit
cc797ee5f1
6 changed files with 74 additions and 226 deletions
|
|
@ -4,17 +4,30 @@ local M = {
|
|||
dependencies = { "neovim/nvim-lspconfig" },
|
||||
}
|
||||
|
||||
local icons = {
|
||||
Error = "",
|
||||
Warning = "",
|
||||
Information = "",
|
||||
Hint = "",
|
||||
Note = " ",
|
||||
}
|
||||
|
||||
-- Map severity to icon
|
||||
local function get_icon(severity)
|
||||
local severity_name = vim.diagnostic.severity[severity]
|
||||
return icons[severity_name] or ""
|
||||
end
|
||||
|
||||
M.init = function()
|
||||
for severity, icon in pairs({
|
||||
[vim.diagnostic.severity.ERROR] = icons.diagnostics.Error,
|
||||
[vim.diagnostic.severity.WARN] = icons.diagnostics.Warning,
|
||||
[vim.diagnostic.severity.INFO] = icons.diagnostics.Information,
|
||||
[vim.diagnostic.severity.HINT] = icons.diagnostics.Hint,
|
||||
}) do
|
||||
local name = "DiagnosticSign" .. vim.diagnostic.severity[severity]
|
||||
vim.fn.sign_define(name, { text = icon, texthl = name })
|
||||
-- Define diagnostic signs
|
||||
local severity_names = { "ERROR", "WARN", "INFO", "HINT" }
|
||||
for _, name in ipairs(severity_names) do
|
||||
local severity = vim.diagnostic.severity[name]
|
||||
local sign_name = "DiagnosticSign" .. name
|
||||
vim.fn.sign_define(sign_name, { text = get_icon(severity), texthl = sign_name })
|
||||
end
|
||||
|
||||
-- Highlight diagnostic signs
|
||||
vim.cmd([[
|
||||
highlight DiagnosticSignError guifg=#f7768e gui=bold
|
||||
highlight DiagnosticSignWarn guifg=#e0af68 gui=bold
|
||||
|
|
@ -24,26 +37,25 @@ M.init = function()
|
|||
end
|
||||
|
||||
-- Cycle through quickfix items
|
||||
local function cycle_qf(cmd)
|
||||
local function cycle_qf(direction)
|
||||
local qf = vim.fn.getqflist({ size = 0, idx = 0 })
|
||||
if qf.size == 0 then
|
||||
return
|
||||
end
|
||||
if cmd == "next" then
|
||||
|
||||
if direction == "next" then
|
||||
vim.cmd(qf.idx == qf.size and "cfirst" or "cnext")
|
||||
elseif cmd == "prev" then
|
||||
else
|
||||
vim.cmd(qf.idx == 1 and "clast" or "cprev")
|
||||
end
|
||||
end
|
||||
|
||||
function M.config()
|
||||
-- Diagnostic configuration using _G.icons.diagnostics
|
||||
-- local icons = _G.icons.diagnostics
|
||||
vim.diagnostic.config({
|
||||
virtual_text = {
|
||||
prefix = "●",
|
||||
format = function(d)
|
||||
return string.format("%s %s", icons[vim.diagnostic.severity[d.severity]], d.message)
|
||||
return string.format("%s %s", get_icon(d.severity), d.message)
|
||||
end,
|
||||
},
|
||||
underline = true,
|
||||
|
|
@ -51,10 +63,10 @@ function M.config()
|
|||
signs = {
|
||||
active = true,
|
||||
text = {
|
||||
[vim.diagnostic.severity.ERROR] = icons.diagnostics.Error,
|
||||
[vim.diagnostic.severity.WARN] = icons.diagnostics.Warning,
|
||||
[vim.diagnostic.severity.INFO] = icons.diagnostics.Information,
|
||||
[vim.diagnostic.severity.HINT] = icons.diagnostics.Hint,
|
||||
[vim.diagnostic.severity.ERROR] = icons.Error,
|
||||
[vim.diagnostic.severity.WARN] = icons.Warning,
|
||||
[vim.diagnostic.severity.INFO] = icons.Information,
|
||||
[vim.diagnostic.severity.HINT] = icons.Hint,
|
||||
},
|
||||
},
|
||||
float = {
|
||||
|
|
@ -63,12 +75,8 @@ function M.config()
|
|||
border = "rounded",
|
||||
source = true,
|
||||
format = function(d)
|
||||
return string.format(
|
||||
"%s %s: %s",
|
||||
icons[vim.diagnostic.severity[d.severity]],
|
||||
vim.diagnostic.severity[d.severity]:lower(),
|
||||
d.message
|
||||
)
|
||||
local severity_name = vim.diagnostic.severity[d.severity]
|
||||
return string.format("%s %s: %s", get_icon(d.severity), severity_name:lower(), d.message)
|
||||
end,
|
||||
},
|
||||
severity_sort = true,
|
||||
|
|
@ -93,19 +101,20 @@ function M.config()
|
|||
},
|
||||
},
|
||||
type_icons = {
|
||||
E = icons.diagnostics.Error .. " ",
|
||||
W = icons.diagnostics.Warning .. " ",
|
||||
I = icons.diagnostics.Information .. " ",
|
||||
N = icons.ui.Note .. " ",
|
||||
H = icons.diagnostics.Hint .. " ",
|
||||
E = icons.Error .. " ",
|
||||
W = icons.Warning .. " ",
|
||||
I = icons.Information .. " ",
|
||||
N = icons.Note,
|
||||
H = icons.Hint .. " ",
|
||||
},
|
||||
})
|
||||
|
||||
-- Quickfix navigation mappings
|
||||
vim.keymap.set("n", "<a-j>", function()
|
||||
nmap("<a-j>", function()
|
||||
cycle_qf("next")
|
||||
end, { desc = "Next quickfix item (cycles)" })
|
||||
vim.keymap.set("n", "<a-k>", function()
|
||||
|
||||
nmap("<a-k>", function()
|
||||
cycle_qf("prev")
|
||||
end, { desc = "Previous quickfix item (cycles)" })
|
||||
end
|
||||
|
|
|
|||
|
|
@ -68,11 +68,11 @@ local M = {
|
|||
current_line_blame_formatter = "<author>, <author_time:%Y-%m-%d> - <summary>",
|
||||
current_line_blame = true,
|
||||
signs = {
|
||||
add = { text = icons.ui.BoldLineMiddle },
|
||||
change = { text = icons.ui.BoldLineDashedMiddle },
|
||||
delete = { text = icons.ui.TriangleShortArrowRight },
|
||||
topdelete = { text = icons.ui.TriangleShortArrowRight },
|
||||
changedelete = { text = icons.ui.BoldLineMiddle },
|
||||
add = { text = "┃" },
|
||||
change = { text = "┋" },
|
||||
delete = { text = "" },
|
||||
topdelete = { text = "" },
|
||||
changedelete = { text = "┃" },
|
||||
},
|
||||
})
|
||||
end,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue