Remove new_async():send() pattern + restructure augroup
This does not load load lualine asyncronasly rather fools the profilers In addition causes issues like intro disapearing
This commit is contained in:
parent
7a45a4f7fe
commit
486be4462f
|
@ -18,7 +18,7 @@ Branch.new = function(self, options, child)
|
||||||
-- run watch head on load so branch is present when component is loaded
|
-- run watch head on load so branch is present when component is loaded
|
||||||
Branch.update_branch()
|
Branch.update_branch()
|
||||||
-- update branch state of BufEnter as different Buffer may be on different repos
|
-- update branch state of BufEnter as different Buffer may be on different repos
|
||||||
vim.cmd [[autocmd BufEnter * lua require'lualine.components.branch'.update_branch()]]
|
vim.cmd [[autocmd lualine BufEnter * lua require'lualine.components.branch'.update_branch()]]
|
||||||
return new_branch
|
return new_branch
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -167,9 +167,6 @@ 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 async_loader
|
|
||||||
async_loader = vim.loop.new_async(vim.schedule_wrap(
|
|
||||||
function()
|
|
||||||
local function get_theme_from_config()
|
local function get_theme_from_config()
|
||||||
local theme_name = config.options.theme
|
local theme_name = config.options.theme
|
||||||
if type(theme_name) == 'string' then
|
if type(theme_name) == 'string' then
|
||||||
|
@ -186,14 +183,9 @@ local function setup_theme()
|
||||||
end
|
end
|
||||||
local theme = get_theme_from_config()
|
local theme = get_theme_from_config()
|
||||||
highlight.create_highlight_groups(theme)
|
highlight.create_highlight_groups(theme)
|
||||||
vim.api.nvim_exec([[
|
vim.cmd [[
|
||||||
augroup lualine
|
autocmd lualine ColorScheme * lua require'lualine.utils.utils'.reload_highlights()
|
||||||
autocmd ColorScheme * lua require'lualine.utils.utils'.reload_highlights()
|
]]
|
||||||
augroup END
|
|
||||||
]], false)
|
|
||||||
async_loader:close()
|
|
||||||
end))
|
|
||||||
async_loader:send()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function set_tabline()
|
local function set_tabline()
|
||||||
|
@ -207,16 +199,21 @@ local function set_statusline()
|
||||||
if next(config.sections) ~= nil or next(config.inactive_sections) ~= nil then
|
if next(config.sections) ~= nil or next(config.inactive_sections) ~= nil then
|
||||||
vim.o.statusline = '%!v:lua.require\'lualine\'.statusline()'
|
vim.o.statusline = '%!v:lua.require\'lualine\'.statusline()'
|
||||||
vim.api.nvim_exec([[
|
vim.api.nvim_exec([[
|
||||||
augroup lualine
|
autocmd lualine WinLeave,BufLeave * lua vim.wo.statusline=require'lualine'.statusline()
|
||||||
autocmd!
|
autocmd lualine BufWinEnter,WinEnter,BufEnter,SessionLoadPost * set statusline<
|
||||||
autocmd WinLeave,BufLeave * lua vim.wo.statusline=require'lualine'.statusline()
|
autocmd lualine VimResized * redrawstatus
|
||||||
autocmd BufWinEnter,WinEnter,BufEnter,SessionLoadPost * set statusline<
|
|
||||||
autocmd VimResized * redrawstatus
|
|
||||||
augroup END
|
|
||||||
]], false)
|
]], false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function setup_augroup()
|
||||||
|
vim.cmd [[
|
||||||
|
augroup lualine
|
||||||
|
autocmd!
|
||||||
|
augroup END
|
||||||
|
]]
|
||||||
|
end
|
||||||
|
|
||||||
local function setup(user_config)
|
local function setup(user_config)
|
||||||
if user_config then
|
if user_config then
|
||||||
config = config_module.apply_configuration(user_config)
|
config = config_module.apply_configuration(user_config)
|
||||||
|
@ -229,6 +226,7 @@ local function setup(user_config)
|
||||||
else
|
else
|
||||||
config = config_module.apply_configuration({})
|
config = config_module.apply_configuration({})
|
||||||
end
|
end
|
||||||
|
setup_augroup()
|
||||||
setup_theme()
|
setup_theme()
|
||||||
loader.load_all(config)
|
loader.load_all(config)
|
||||||
set_statusline()
|
set_statusline()
|
||||||
|
|
|
@ -24,9 +24,6 @@ local function component_loader(component)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function load_sections(sections, options)
|
local function load_sections(sections, options)
|
||||||
local async_loader
|
|
||||||
async_loader = vim.loop.new_async(vim.schedule_wrap(
|
|
||||||
function()
|
|
||||||
for section_name, section in pairs(sections) do
|
for section_name, section in pairs(sections) do
|
||||||
for index, component in pairs(section) do
|
for index, component in pairs(section) do
|
||||||
if type(component) == 'string' or type(component) == 'function' then
|
if type(component) == 'string' or type(component) == 'function' then
|
||||||
|
@ -39,9 +36,6 @@ local function load_sections(sections, options)
|
||||||
section[index] = component_loader(component)
|
section[index] = component_loader(component)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
async_loader:close()
|
|
||||||
end))
|
|
||||||
async_loader:send()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function load_components(config)
|
local function load_components(config)
|
||||||
|
|
Loading…
Reference in New Issue