From 5c7052140a34646a42d06195692e6f25738117a1 Mon Sep 17 00:00:00 2001 From: Dreaded_X Date: Fri, 20 Feb 2026 02:00:56 +0100 Subject: [PATCH] Fixed schemacompanion lualine --- nvim/dot-config/nvim/lua/plugins/lualine.lua | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/nvim/dot-config/nvim/lua/plugins/lualine.lua b/nvim/dot-config/nvim/lua/plugins/lualine.lua index 994404e..f3373f3 100644 --- a/nvim/dot-config/nvim/lua/plugins/lualine.lua +++ b/nvim/dot-config/nvim/lua/plugins/lualine.lua @@ -5,11 +5,20 @@ local function get_schema() return "" end - local schema = (require("schema-companion").get_current_schemas() or "none") - if schema == "none" then + -- The provided get_current_schema function returns nonenil when no schema is known. + -- Instead we use a custom implemention that does not do that. + -- Also has the added benefit of giving more control over formatting + local schemas = require("schema-companion").get_matching_schemas() + if schemas == nil or #schemas == 0 then return "" end - return schema + + schema = schemas[1] + if schema.name == "none" then + return "" + end + + return ("%s%s"):format(schema.name, #schemas > 1 and (" (+%d)"):format(#schemas - 1) or "") end --- @module "lazy"