Updated plugins

This commit is contained in:
2024-03-18 20:19:40 +01:00
parent 546b3c836d
commit 78413f7b13
2 changed files with 45 additions and 1 deletions

View File

@@ -51,6 +51,32 @@ return {
t = colors.red,
}
local function mason_updates()
local registry = require("mason-registry")
local installed_packages = registry.get_installed_package_names()
local upgrades_available = false
local packages_outdated = 0
function myCallback(success, result_or_err)
if success then
upgrades_available = true
packages_outdated = packages_outdated + 1
end
end
for _, pkg in pairs(installed_packages) do
local p = registry.get_package(pkg)
if p then
p:check_new_version(myCallback)
end
end
if upgrades_available then
return packages_outdated
else
return 0
end
end
local mode = {
"mode",
separator = { left = "" },
@@ -120,6 +146,17 @@ return {
end)
end,
}
local mason = {
mason_updates() .. "",
color = { fg = colors.violet },
cond = function()
return mason_updates() > 0
end,
icon = "",
on_click = function()
vim.cmd("Mason")
end,
}
local filetype = {
"filetype",
color = { fg = colors.darkblue },
@@ -146,7 +183,7 @@ return {
lualine_a = { mode },
lualine_b = { filename, branch },
lualine_c = { diagnostics, "%=", harpoon },
lualine_x = { copilot, diff, fileformat, lazy },
lualine_x = { copilot, diff, fileformat, lazy, mason },
lualine_y = { filetype, progress },
lualine_z = { location },
},