refactor(theme): clean up theme + better organization
This commit is contained in:
parent
ca9e3a0af1
commit
c19b565f0e
5 changed files with 20 additions and 11 deletions
16
lua/cosmic/core/init.lua
Normal file
16
lua/cosmic/core/init.lua
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
local cosmic_modules = {
|
||||||
|
'cosmic.core.disabled',
|
||||||
|
'cosmic.core.pluginsInit',
|
||||||
|
'cosmic.core.commands',
|
||||||
|
'cosmic.core.editor',
|
||||||
|
'cosmic.config.editor',
|
||||||
|
'cosmic.core.mappings',
|
||||||
|
'cosmic.config.mappings',
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, mod in ipairs(cosmic_modules) do
|
||||||
|
local ok, err = pcall(require, mod)
|
||||||
|
if not ok and not mod:find('cosmic.config') then
|
||||||
|
error(('Error loading %s...\n\n%s'):format(mod, err))
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,13 +1,7 @@
|
||||||
local cosmic_modules = {
|
local cosmic_modules = {
|
||||||
'cosmic.compiled',
|
'cosmic.compiled',
|
||||||
'cosmic.core.disabled',
|
'cosmic.core',
|
||||||
'cosmic.pluginsInit',
|
'cosmic.theme',
|
||||||
'cosmic.core.commands',
|
|
||||||
'cosmic.core.editor',
|
|
||||||
'cosmic.config.editor',
|
|
||||||
'cosmic.core.mappings',
|
|
||||||
'cosmic.config.mappings',
|
|
||||||
'cosmic.theme.highlights',
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, mod in ipairs(cosmic_modules) do
|
for _, mod in ipairs(cosmic_modules) do
|
||||||
|
|
|
@ -74,8 +74,7 @@ end
|
||||||
|
|
||||||
function M.post_reload(msg)
|
function M.post_reload(msg)
|
||||||
unload('cosmic.utils', true)
|
unload('cosmic.utils', true)
|
||||||
unload('cosmic.theme.colors', true)
|
unload('cosmic.theme', true)
|
||||||
unload('cosmic.theme.highlights', true)
|
|
||||||
unload('cosmic.modules.statusline', true)
|
unload('cosmic.modules.statusline', true)
|
||||||
msg = msg or 'User config reloaded!'
|
msg = msg or 'User config reloaded!'
|
||||||
Logger:log(msg)
|
Logger:log(msg)
|
||||||
|
@ -85,7 +84,7 @@ function M.reload_user_config_sync()
|
||||||
M.reload_user_config()
|
M.reload_user_config()
|
||||||
clear_cache()
|
clear_cache()
|
||||||
unload('cosmic.config', true)
|
unload('cosmic.config', true)
|
||||||
unload('cosmic.modulesInit', true)
|
unload('cosmic.core.pluginsInit', true)
|
||||||
vim.cmd([[autocmd User PackerCompileDone ++once lua require('cosmic.utils').post_reload()]])
|
vim.cmd([[autocmd User PackerCompileDone ++once lua require('cosmic.utils').post_reload()]])
|
||||||
vim.cmd(':PackerSync')
|
vim.cmd(':PackerSync')
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue