diff --git a/lua/lualine/config.lua b/lua/lualine/config.lua index 5e1fafe..53a1a11 100644 --- a/lua/lualine/config.lua +++ b/lua/lualine/config.lua @@ -41,27 +41,21 @@ local function fix_separators(separators) end local function apply_configuration(config_table) + if not config_table then return vim.deepcopy(config) end local function parse_sections(section_group_name) if not config_table[section_group_name] then return end for section_name, section in pairs(config_table[section_group_name]) do config[section_group_name][section_name] = vim.deepcopy(config_table[section_group_name][section_name]) - if type(section) == 'table' then - for _, component in pairs(config[section_group_name][section_name]) do - if type(component) == 'table' and type(component[2]) == 'table' then - local options = component[2] - component[2] = nil - for key, val in pairs(options) do component[key] = val end - end - end - end end end parse_sections('options') parse_sections('sections') parse_sections('inactive_sections') parse_sections('tabline') - if config_table.extensions then config.extensions = config_table.extensions end + if config_table.extensions then + config.extensions = vim.deepcopy(config_table.extensions) + end config.options.section_separators = fix_separators( config.options.section_separators) config.options.component_separators = fix_separators( diff --git a/lua/lualine/init.lua b/lua/lualine/init.lua index 773482c..f56f9a6 100644 --- a/lua/lualine/init.lua +++ b/lua/lualine/init.lua @@ -218,17 +218,7 @@ local function setup_augroup() end local function setup(user_config) - if user_config then - config = config_module.apply_configuration(user_config) - elseif vim.g.lualine then - vim.schedule(function() - vim.api.nvim_err_writeln( - [[Lualine: lualine will stop supporting vimscript soon, change your config to lua or wrap it around lua << EOF ... EOF]]) -- luacheck: ignore - end) - config = config_module.apply_configuration(vim.g.lualine) - else - config = config_module.apply_configuration({}) - end + config = config_module.apply_configuration(user_config) setup_augroup() setup_theme() loader.load_all(config)