forked from NormalNvim/NormalNvim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.lua
48 lines (43 loc) · 1.24 KB
/
init.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
-- HELLO, welcome to NormalNvim!
-- ---------------------------------------
-- This is the entry point of your config.
-- ---------------------------------------
local function load_source(source)
local status_ok, error = pcall(require, source)
if not status_ok then
vim.api.nvim_err_writeln("Failed to load " .. source .. "\n\n" .. error)
end
end
local function load_sources(source_files)
vim.loader.enable()
for _, source in ipairs(source_files) do
load_source(source)
end
end
local function load_sources_async(source_files)
for _, source in ipairs(source_files) do
vim.defer_fn(function()
load_source(source)
end, 50)
end
end
local function load_colorscheme_async(colorscheme)
vim.defer_fn(function()
if vim.g.default_colorscheme then
if not pcall(vim.cmd.colorscheme, colorscheme) then
require("base.utils").notify(
"Error setting up colorscheme: " .. colorscheme,
vim.log.levels.ERROR
)
end
end
end, 0)
end
-- Call the functions defined above.
load_sources({
"base.1-options",
"base.2-lazy",
"base.3-autocmds", -- critical stuff, don't change the execution order.
})
load_colorscheme_async(vim.g.default_colorscheme)
load_sources_async({ "base.4-mappings" })