From 64ab49f55ada99db1e613fc1b9b484921c37c21e Mon Sep 17 00:00:00 2001 From: Shadman Date: Tue, 4 May 2021 05:03:26 +0600 Subject: [PATCH] partially revert f08e8514 (#209) Deepcopying default config is not reverted . And now user config is always applied on top of default_config. Functionaly it should be same as before f98e8514 --- lua/lualine/init.lua | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/lua/lualine/init.lua b/lua/lualine/init.lua index 3c18eab..aabe7f3 100644 --- a/lua/lualine/init.lua +++ b/lua/lualine/init.lua @@ -2,17 +2,11 @@ -- MIT license, see LICENSE for more details. local utils_section = require('lualine.utils.section') local highlight = require('lualine.highlight') -local config = vim.deepcopy(require('lualine.defaults')) +local config = {} local function apply_configuration(config_table) if not config_table then return end local function parse_sections(section_group_name) - if section_group_name ~= 'options' then - config[section_group_name] = {} -- clear old config - else - -- reset options - config.options = vim.deepcopy(require'lualine.defaults'.options) - end 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] = @@ -32,7 +26,7 @@ local function apply_configuration(config_table) parse_sections('sections') parse_sections('inactive_sections') parse_sections('tabline') - config.extensions = config_table.extensions or {} + if config_table.extensions then config.extensions = config_table.extensions end end local function check_single_separator() @@ -285,8 +279,9 @@ local function set_statusline() end local function setup(user_config) - if not user_config then apply_configuration(vim.g.lualine) end - apply_configuration(user_config) + config = vim.deepcopy(require'lualine.defaults') + if user_config then apply_configuration(user_config) + elseif vim.g.lualine then apply_configuration(vim.g.lualine) end check_single_separator() setup_theme() load_components()