feat(utils): slightly better reload functions
This commit is contained in:
parent
fab66bb685
commit
1d8f81b737
3 changed files with 15 additions and 4 deletions
|
@ -2,4 +2,5 @@ vim.cmd([[
|
||||||
command! CosmicUpdate lua require('cosmic.utils').update()
|
command! CosmicUpdate lua require('cosmic.utils').update()
|
||||||
command! CosmicReloadConfig lua require('cosmic.utils').reload_user_config()
|
command! CosmicReloadConfig lua require('cosmic.utils').reload_user_config()
|
||||||
command! CosmicReload lua require('cosmic.utils').reload_cosmic()
|
command! CosmicReload lua require('cosmic.utils').reload_cosmic()
|
||||||
|
command! CosmicReloadSync lua require('cosmic.utils').reload_cosmic(true)
|
||||||
]])
|
]])
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
local cosmic_modules = {
|
local cosmic_modules = {
|
||||||
|
'cosmic.compiled',
|
||||||
'cosmic.disabled',
|
'cosmic.disabled',
|
||||||
'cosmic.pluginsInit',
|
'cosmic.pluginsInit',
|
||||||
'cosmic.compiled',
|
|
||||||
'cosmic.commands',
|
'cosmic.commands',
|
||||||
'cosmic.editor',
|
'cosmic.editor',
|
||||||
'cosmic.mappings',
|
'cosmic.mappings',
|
||||||
|
|
|
@ -66,13 +66,23 @@ local function unload(module_pattern, reload)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.reload_user_config()
|
function M.reload_user_config()
|
||||||
unload('cosmic.config', true)
|
unload('cosmic.config')
|
||||||
|
require('cosmic')
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.reload_cosmic()
|
function M.reload_cosmic(sync)
|
||||||
unload('cosmic')
|
unload('cosmic')
|
||||||
require('cosmic')
|
require('cosmic')
|
||||||
vim.cmd(':e')
|
if sync then
|
||||||
|
require('cosmic.packer').packer.sync()
|
||||||
|
else
|
||||||
|
require('cosmic.packer').packer.compile()
|
||||||
|
end
|
||||||
|
vim.cmd(':silent e')
|
||||||
|
vim.notify('CosmicNvim reloaded!', vim.log.levels.INFO, {
|
||||||
|
title = 'CosmicNvim',
|
||||||
|
})
|
||||||
|
-- vim.cmd(':silent bufdo e')
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.get_install_dir()
|
function M.get_install_dir()
|
||||||
|
|
Loading…
Add table
Reference in a new issue