From b05783de8c518c8a6e5c3f648448c3a6f00d0050 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Mon, 9 Oct 2023 09:13:14 +0200 Subject: [PATCH] feat(codeium): added lualine component with codeium status similar to copilot --- lua/lazyvim/plugins/extras/coding/codeium.lua | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/lua/lazyvim/plugins/extras/coding/codeium.lua b/lua/lazyvim/plugins/extras/coding/codeium.lua index d809ab85..f8d4c671 100644 --- a/lua/lazyvim/plugins/extras/coding/codeium.lua +++ b/lua/lazyvim/plugins/extras/coding/codeium.lua @@ -22,4 +22,48 @@ return { end, }, + { + "nvim-lualine/lualine.nvim", + optional = true, + event = "VeryLazy", + opts = function(_, opts) + local started = false + local function status() + if not package.loaded["cmp"] then + return + end + for _, s in ipairs(require("cmp").core.sources) do + if s.name == "codeium" then + if s.source:is_available() then + started = true + else + return started and "error" or nil + end + if s.status == s.SourceStatus.FETCHING then + return "pending" + end + return "ok" + end + end + end + + local Util = require("lazyvim.util") + local colors = { + ok = Util.fg("Special"), + error = Util.fg("DiagnosticError"), + pending = Util.fg("DiagnosticWarn"), + } + table.insert(opts.sections.lualine_x, 2, { + function() + return require("lazyvim.config").icons.kinds.Codeium + end, + cond = function() + return status() ~= nil + end, + color = function() + return colors[status()] or colors.ok + end, + }) + end, + }, }