-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.lua
48 lines (42 loc) · 1.26 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
--
-- This module contains a high-level initialisation for NeoVim
--
local dynload = require("dynload")
local function script_path()
local str = debug.getinfo(2, "S").source:sub(2)
return str:match("(.*/)")
end
--
-- Load all modules/plugins in a given subfolder.
--
-- Each plugin must expose a no-arg function "run()" to initialiase & configure
-- the plugin. Example:
--
-- function run()
-- require('packer').use('tpope/vim-unimpaired')
-- end
--
-- return {
-- run=run
-- }
--
local function load_modules(folder)
local plugins = dynload.load_modules(folder)
for _, plugin in ipairs(plugins) do
local is_success, error_msg = pcall(plugin.module.run)
if not is_success then
error(string.format("Error calling %s.run(): %s", plugin.name, error_msg))
end
end
end
-- ---------------------------------------------------------------------------
-- Call early boot-strapping code for the rest of the config
local bootstrap = require("bootstrap")
bootstrap.run()
load_modules(script_path() .. "/lua/plugins_d")
load_modules(script_path() .. "/lua/behaviour")
load_modules(script_path() .. "/lua/look_and_feel")
-- TODO setup_linter()
-- TODO setup_code_formatter()
-- TODO define_keymappings()
-- TODO define_look_and_feel()