Skip to content

Commit

Permalink
feat(feline): add lazy.nvim updates module, replace deprecated API (c…
Browse files Browse the repository at this point in the history
…atppuccin#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
  • Loading branch information
ilias777 authored Jul 10, 2024
1 parent 2d3419c commit 47bd419
Showing 1 changed file with 32 additions and 3 deletions.
35 changes: 32 additions & 3 deletions lua/catppuccin/groups/integrations/feline.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 47bd419

Please # to comment.