This repository was archived by the owner on Sep 3, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.lua
More file actions
143 lines (119 loc) · 2.83 KB
/
init.lua
File metadata and controls
143 lines (119 loc) · 2.83 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
--
-- Neovim configuration
--
local nvim_version = "0.10.0"
if vim.fn.has("nvim-" .. nvim_version) ~= 1 then
vim.notify("neovim version required: >=" .. nvim_version, vim.log.levels.ERROR)
return
end
--
-- Get lazy.nvim
--
---@type string
local LAZY_PATH = vim.fs.joinpath(vim.fn.stdpath("data") --[[@as string]], "lazy", "lazy.nvim")
if not vim.uv.fs_stat(LAZY_PATH) then
local result = vim
.system({
"git",
"clone",
"--filter=blob:none",
"--branch=stable",
"https://github.com/folke/lazy.nvim.git",
LAZY_PATH,
}, {
stdout = false,
stderr = false,
})
:wait()
if result.code ~= 0 then
vim.notify("couldn't clone lazy.nvim", vim.log.levels.ERROR)
return
end
end
vim.opt.runtimepath:prepend(LAZY_PATH)
if not pcall(require, "lazy") then
vim.notify("lazy.nvim is broken. Try erasing " .. LAZY_PATH, vim.log.levels.ERROR)
return
end
local c11n = require("c11n")
--
-- Load configuration for external tools
--
require("lazy.core.util").lsmod("c11n.externals", function(modname, _)
require(modname)
end)
--
-- Load management utilities
--
c11n.on_user("VeryLazy", function(_)
require("c11n.manage").setup()
end)
--
-- Apply settings
--
local get_local_settings = loadfile(c11n.local_config_path)
if get_local_settings then
local local_settings = get_local_settings()
local ok, error = pcall(c11n.settings.merge, local_settings)
if not ok then
c11n.on_user("VeryLazy", function(_)
vim.notify(error, vim.log.levels.ERROR)
end)
end
end
local settings = c11n.settings.get()
-- Language
local _ = pcall(vim.cmd.language, settings.language)
---@type LazySpec
local lazy_spec = {
-- add LazyVim and import its plugins
{
"LazyVim/LazyVim",
import = "lazyvim.plugins",
opts = {
colorscheme = settings.colorscheme,
news = {
lazyvim = true,
neovim = true,
},
},
},
-- default basic configuration
{ import = "plugins._base" },
}
-- add selected preset
if settings.preset then
---@diagnostic disable-next-line: param-type-mismatch
table.insert(lazy_spec, { import = "plugins." .. settings.preset })
end
-- add selected preset
if settings.lazyspec then
---@diagnostic disable-next-line: param-type-mismatch
vim.list_extend(lazy_spec, settings.lazyspec)
end
---@type LazyConfig
local lazy_config = {
spec = lazy_spec,
defaults = {
lazy = false,
version = false, -- always use the latest git commit
},
install = {
colorscheme = { settings.colorscheme, "habamax" },
},
checker = {
enabled = true, -- check for plugin updates periodically
notify = true, -- notify on update
},
performance = {
rtp = {
-- disable some rtp plugins
disabled_plugins = settings.disabled_plugins,
},
},
}
--
-- Setup
--
require("lazy").setup(lazy_config)
-- Initialization end