[3/4] Refactor: init: Use async | Move theme stuff to theme.lua
third commit of refactor perf improvements due to async run packer sync if base16 not found this is not perfect error handling for initial run, but something handle require errors
This commit is contained in:
36
init.lua
36
init.lua
@@ -1,14 +1,28 @@
|
||||
-- load all plugins
|
||||
require "pluginList"
|
||||
-- load all options
|
||||
require "options"
|
||||
|
||||
-- colorscheme related stuff
|
||||
vim.g.nvchad_theme = "onedark"
|
||||
local base16 = require "base16"
|
||||
base16(base16.themes["onedark"], true)
|
||||
-- only try to load stuff if atleast base16 is initialized
|
||||
-- TODO: Find a better way to trigger PackerSync
|
||||
if require "theme" then
|
||||
local async
|
||||
async =
|
||||
vim.loop.new_async(
|
||||
vim.schedule_wrap(
|
||||
function()
|
||||
require "pluginList"
|
||||
require "plugins.bufferline"
|
||||
require "highlights"
|
||||
require "mappings"
|
||||
require("utils").hideStuff()
|
||||
|
||||
require "highlights"
|
||||
require "mappings"
|
||||
require "plugins.bufferline"
|
||||
|
||||
require("utils").hideStuff()
|
||||
async:close()
|
||||
end
|
||||
)
|
||||
)
|
||||
async:send()
|
||||
else
|
||||
-- otherwise run packer sync
|
||||
require "pluginList"
|
||||
print("Now PackerSync will be executed, after completion, restart neovim.\n")
|
||||
vim.cmd("PackerSync")
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user