Skip to content

Commit c7fdd44

Browse files
committed
fix(ui): guard against nil colors_name in lualine/bufferline
vim.g.colors_name is nil until a colorscheme is applied, so calling :find() on it directly could error if these modules load before any :colorscheme. Coalesce to an empty string, matching the safe pattern already used in modules/utils/init.lua.
1 parent dd84883 commit c7fdd44

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

lua/modules/configs/ui/bufferline.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ return function()
4040
highlights = {},
4141
}
4242

43-
if vim.g.colors_name:find("catppuccin") then
43+
if (vim.g.colors_name or ""):find("catppuccin") then
4444
local cp = require("modules.utils").get_palette() -- Get the palette.
4545

4646
local catppuccin_hl_overwrite = {

lua/modules/configs/ui/lualine.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ vim.api.nvim_create_autocmd("LspProgress", {
4141
})
4242

4343
return function()
44-
local has_catppuccin = vim.g.colors_name:find("catppuccin") ~= nil
44+
local has_catppuccin = (vim.g.colors_name or ""):find("catppuccin") ~= nil
4545
local colors = require("modules.utils").get_palette()
4646
local icons = {
4747
diagnostics = require("modules.utils.icons").get("diagnostics", true),
@@ -57,7 +57,7 @@ return function()
5757
group = vim.api.nvim_create_augroup("LualineColorScheme", { clear = true }),
5858
pattern = "*",
5959
callback = function()
60-
has_catppuccin = vim.g.colors_name:find("catppuccin") ~= nil
60+
has_catppuccin = (vim.g.colors_name or ""):find("catppuccin") ~= nil
6161
require("lualine").setup({ options = { theme = custom_theme() } })
6262
end,
6363
})

0 commit comments

Comments
 (0)