This commit is contained in:
Christoph J. Scherr 2024-01-20 16:40:35 +01:00
parent 0acdd8230b
commit 382883afb6
Signed by: PlexSheep
GPG Key ID: 7CDD0B14851A08EF
1 changed files with 54 additions and 1 deletions

View File

@ -236,7 +236,7 @@ local plugins = {
HACK = { icon = "", color = "warning" }, HACK = { icon = "", color = "warning" },
SECURITY = { icon = "󰒃 ", color = "warning" }, SECURITY = { icon = "󰒃 ", color = "warning" },
WARN = { icon = "", color = "warning", alt = { "WARNING", "XXX" } }, WARN = { icon = "", color = "warning", alt = { "WARNING", "XXX" } },
PERF = { icon = " ", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } }, PERF = { icon = " ", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } },
NOTE = { icon = "", color = "hint", alt = { "INFO" } }, NOTE = { icon = "", color = "hint", alt = { "INFO" } },
TEST = { icon = "", color = "test", alt = { "TESTING", "PASSED", "FAILED" } }, TEST = { icon = "", color = "test", alt = { "TESTING", "PASSED", "FAILED" } },
}, },
@ -634,6 +634,59 @@ local plugins = {
{ "S", "<cmd>TSJSplit<CR>" }, { "S", "<cmd>TSJSplit<CR>" },
}, },
}, },
{
"b0o/incline.nvim",
event = "FileType",
config = function()
local function get_diagnostic_label(props)
local icons = { error = "", warn = "", info = "", hint = "" }
local label = {}
for severity, icon in pairs(icons) do
local n = #vim.diagnostic.get(props.buf, { severity = vim.diagnostic.severity[string.upper(severity)] })
if n > 0 then
table.insert(label, { icon .. " " .. n .. " ", group = "DiagnosticSign" .. severity })
end
end
if #label > 0 then
table.insert(label, { "| " })
end
return label
end
local function get_git_diff(props)
local icons = { removed = "", changed = "", added = "" }
local labels = {}
local signs = vim.api.nvim_buf_get_var(props.buf, "gitsigns_status_dict")
-- local signs = vim.b.gitsigns_status_dict
for name, icon in pairs(icons) do
if tonumber(signs[name]) and signs[name] > 0 then
table.insert(labels, { icon .. " " .. signs[name] .. " ", group = "Diff" .. name })
end
end
if #labels > 0 then
table.insert(labels, { "| " })
end
return labels
end
require("incline").setup {
render = function(props)
local filename = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(props.buf), ":t")
local ft_icon, ft_color = require("nvim-web-devicons").get_icon_color(filename)
local modified = vim.api.nvim_buf_get_option(props.buf, "modified") and "bold,italic" or "bold"
local buffer = {
{ get_diagnostic_label(props) },
{ get_git_diff(props) },
{ ft_icon, guifg = ft_color },
{ " " },
{ filename, gui = modified },
}
return buffer
end,
}
end,
},
} }
return plugins return plugins