mirror of
https://github.com/catppuccin/nvim
synced 2024-09-16 13:24:08 +02:00
feat(feline): add lazy.nvim updates module, replace deprecated API (#725)
* Add lazy.nvim plugin updates in feline * Use pcall for checking if lazy.nvim is installed * fix(feline): fix provider option for lazy updates * refactor(feline): update deprecated api functions
This commit is contained in:
parent
2d3419c2ae
commit
47bd419c0c
1 changed files with 32 additions and 3 deletions
|
@ -139,6 +139,12 @@ function M.get()
|
|||
return false
|
||||
end
|
||||
|
||||
-- Check if lazy.nvim is installed
|
||||
local has_lazy = function()
|
||||
local lazy_installed, _ = pcall(require, "lazy")
|
||||
return lazy_installed
|
||||
end
|
||||
|
||||
-- #################### STATUSLINE ->
|
||||
|
||||
-- ######## Left
|
||||
|
@ -287,7 +293,7 @@ function M.get()
|
|||
-- macro
|
||||
components.active[1][12] = {
|
||||
provider = "macro",
|
||||
enabled = function() return vim.api.nvim_get_option "cmdheight" == 0 end,
|
||||
enabled = function() return vim.api.nvim_get_option_value("cmdheight", { scope = "global" }) == 0 end,
|
||||
hl = {
|
||||
fg = sett.extras,
|
||||
bg = sett.bkg,
|
||||
|
@ -298,7 +304,30 @@ function M.get()
|
|||
-- search count
|
||||
components.active[1][13] = {
|
||||
provider = "search_count",
|
||||
enabled = function() return vim.api.nvim_get_option "cmdheight" == 0 end,
|
||||
enabled = function() return vim.api.nvim_get_option_value("cmdheight", { scope = "global" }) == 0 end,
|
||||
hl = {
|
||||
fg = sett.extras,
|
||||
bg = sett.bkg,
|
||||
},
|
||||
left_sep = invi_sep,
|
||||
}
|
||||
|
||||
-- lazy.nvim updates
|
||||
components.active[1][14] = {
|
||||
provider = function()
|
||||
if has_lazy() then
|
||||
return require("lazy.status").updates()
|
||||
else
|
||||
return " "
|
||||
end
|
||||
end,
|
||||
enabled = function()
|
||||
if has_lazy() then
|
||||
return require("lazy.status").has_updates()
|
||||
else
|
||||
return false
|
||||
end
|
||||
end,
|
||||
hl = {
|
||||
fg = sett.extras,
|
||||
bg = sett.bkg,
|
||||
|
@ -412,7 +441,7 @@ function M.get()
|
|||
|
||||
components.active[3][2] = {
|
||||
provider = function()
|
||||
local active_clients = vim.lsp.get_active_clients { bufnr = 0 }
|
||||
local active_clients = vim.lsp.get_clients { bufnr = 0 }
|
||||
|
||||
-- show an indicator that we have running lsps
|
||||
if view.lsp.name == false and next(active_clients) ~= nil then return assets.lsp.server .. " " .. "Lsp" end
|
||||
|
|
Loading…
Reference in a new issue