fix: Partially process config when setup is called

Otherwise successive calls to setups before redraw are ignored.

closes #12
This commit is contained in:
shadmansaleh 2021-08-17 13:26:44 +06:00
parent fcb61280f2
commit bdc3073d31
1 changed files with 4 additions and 4 deletions

View File

@ -9,7 +9,7 @@ local modules = require('lualine.utils.lazy_require'){
config_module = 'lualine.config', config_module = 'lualine.config',
} }
local config -- Stores cureently applied config local config -- Stores cureently applied config
local new_config = {} -- Stores config that will be applied local new_config = true -- Stores config that will be applied
local function apply_transitional_separators(previous_section, current_section, local function apply_transitional_separators(previous_section, current_section,
next_section) next_section)
@ -251,7 +251,6 @@ end
local function reset_lualine() local function reset_lualine()
modules.utils_notices.clear_notices() modules.utils_notices.clear_notices()
config = modules.config_module.apply_configuration(new_config)
setup_augroup() setup_augroup()
setup_theme() setup_theme()
modules.loader.load_all(config) modules.loader.load_all(config)
@ -287,7 +286,8 @@ local function status_dispatch()
end end
local function setup(user_config) local function setup(user_config)
new_config = user_config or {} new_config = true
config = modules.config_module.apply_configuration(user_config)
vim.go.statusline = "%{%v:lua.require'lualine'.statusline()%}" vim.go.statusline = "%{%v:lua.require'lualine'.statusline()%}"
end end
@ -295,5 +295,5 @@ return {
setup = setup, setup = setup,
statusline = status_dispatch, statusline = status_dispatch,
tabline = tabline, tabline = tabline,
get_config = function() return modules.config_module.get_config() end, get_config = modules.config_module.get_config,
} }