-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.lua
42 lines (30 loc) · 1.27 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
--- Globals
-- Improved loader that byte-compile and caches lua files (experimental)
vim.loader.enable()
---@type boolean Workstation machine or laptop
Workstation = vim.fn.hostname() == "hal-9002"
---Path of the neovim config folder (`~/.config/nvim`).
NeovimPath = vim.fn.stdpath("config") --[[@as string]]
---Path of the lua config (`nvim/lua/config/`).
MyConfigPath = NeovimPath .. "/lua/config/"
---Path of my custom plugins sources `outside` Nvim's rtp. (`$USR_PROJECTS_DIR/Neovim/`)
MyPluginsPath = vim.fn.expand("$USR_PROJECTS_DIR/" .. (Workstation and "Neovim/" or ""))
---Path to store scratch notes (`~/.local/share/nvim/scratchs/`)
ScratchNotesPath = vim.fn.stdpath("data") .. "/scratch/"
-- Check paths
assert(vim.fn.finddir(MyConfigPath) ~= "", "Unexpected: Missing configuration path?!")
if vim.fn.finddir(MyPluginsPath) == "" then
vim.notify("Missing personal plugins path.", vim.log.levels.WARN)
end
-- Set global variables for vimscript env
vim.api.nvim_set_var("NeovimPath", NeovimPath)
vim.api.nvim_set_var("MyConfigPath", MyConfigPath)
--- Helper functions
local u = require("utils") --[[@as Utils]]
u.load_utils({ debug = false })
--- Load configs
u.load("config.settings")
u.load("config.mappings")
assert(u.check_errors(true))
u.load("config.lazy")
u.check_errors()