-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.lua
More file actions
75 lines (62 loc) · 1.8 KB
/
init.lua
File metadata and controls
75 lines (62 loc) · 1.8 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
local notify = nil
do
local ok, loaded = pcall(require, "devil.utils.notify")
if ok then
notify = loaded
end
end
local function emit(msg, level)
if notify then
notify.notify(msg, level)
else
vim.notify(msg, level)
end
end
if vim.fn.has("nvim-0.11") ~= 1 then
emit("This config is only available on Neovim >= 0.11", vim.log.levels.ERROR)
return
end
-- Gentoo commonly ships extra Vim runtime files in this path.
-- Keep it in runtimepath for compatibility with system-wide Vim plugins/scripts.
if vim.uv.os_uname().release:match("gentoo") then
vim.opt.rtp:append("/usr/share/vim/vimfiles")
end
---Load module safely and notify on failure.
---@param module string
---@param level? integer
---@return any|nil
local function safe_require(module, level)
local ok, loaded = pcall(require, module)
if not ok then
emit(("Failed to load `%s`: %s"):format(module, loaded), level or vim.log.levels.WARN)
return nil
end
return loaded
end
-- Core setup
safe_require("devil.core", vim.log.levels.ERROR)
safe_require("devil.core.bootstrap", vim.log.levels.ERROR)
-- Plugin manager setup
safe_require("devil.plugins", vim.log.levels.ERROR)
local mappings = safe_require("devil.core.mappings")
if mappings and type(mappings.setup_early_mappings) == "function" then
mappings.setup_early_mappings()
end
-- Key mappings
local utils = safe_require("devil.utils")
if utils and type(utils.load_mappings) == "function" then
utils.load_mappings()
end
-- Language Server Protocol
safe_require("devil.lsp")
-- Completion engine
safe_require("devil.complete")
-- Formatter and linter
safe_require("devil.fmt-lint")
-- Debug Adapter Protocol
safe_require("devil.dap")
-- Custom commands
safe_require("devil.commands")
safe_require("devil.core.colorscheme")
-- Playground code
-- require("devil.playground.setup")