fix: theme type check fix (#165)
* fix: theme type check fix * fix: string concat bug * fix: removed semmicolon
This commit is contained in:
parent
23e6bd5dd7
commit
2b32fb090f
|
@ -266,23 +266,24 @@ end
|
||||||
local function tabline() return statusline(config.tabline, true) end
|
local function tabline() return statusline(config.tabline, true) end
|
||||||
|
|
||||||
local function setup_theme()
|
local function setup_theme()
|
||||||
local theme_name = config.options.theme
|
local function get_theme_from_config()
|
||||||
local ok, theme
|
local theme_name = config.options.theme
|
||||||
if type(theme_name) == 'string' then
|
if type(theme_name) == 'string' then
|
||||||
ok, theme = pcall(require, 'lualine.themes.' .. theme_name)
|
local ok, theme = pcall(require, 'lualine.themes.' .. theme_name)
|
||||||
if not ok then
|
if ok then return theme end
|
||||||
vim.api.nvim_echo({
|
elseif type(theme_name) == 'table' then
|
||||||
{
|
-- use the provided theme as-is
|
||||||
'theme ' .. theme_name .. ' not found defaulting to gruvbox',
|
return config.options.theme
|
||||||
'ErrorMsg'
|
|
||||||
}
|
|
||||||
}, true, {})
|
|
||||||
theme = require 'lualine.themes.gruvbox'
|
|
||||||
end
|
end
|
||||||
else
|
vim.api.nvim_echo({
|
||||||
-- use the provided theme as-is, assuming it's a dictionary
|
{
|
||||||
theme = config.options.theme
|
'theme ' .. tostring(theme_name) .. ' not found, defaulting to gruvbox',
|
||||||
|
'ErrorMsg'
|
||||||
|
}
|
||||||
|
}, true, {})
|
||||||
|
return require 'lualine.themes.gruvbox'
|
||||||
end
|
end
|
||||||
|
local theme = get_theme_from_config()
|
||||||
highlight.create_highlight_groups(theme)
|
highlight.create_highlight_groups(theme)
|
||||||
vim.api.nvim_exec([[
|
vim.api.nvim_exec([[
|
||||||
augroup lualine
|
augroup lualine
|
||||||
|
|
Loading…
Reference in New Issue