-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathinit.lua
More file actions
65 lines (55 loc) · 2.27 KB
/
init.lua
File metadata and controls
65 lines (55 loc) · 2.27 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
Ice = {}
require "core.init"
require "plugins.init"
local config_root = vim.fn.stdpath "config"
local custom_path = vim.fs.joinpath(config_root, "lua/custom")
if not vim.api.nvim_get_runtime_file("lua/custom/", false)[1] then
os.execute('mkdir "' .. custom_path .. '"')
end
if vim.uv.fs_stat(vim.fs.joinpath(custom_path, "init.lua")) then
require "custom.init"
end
require("core.utils").group_map(Ice.keymap)
for filetype, config in pairs(Ice.ft) do
require("core.utils").ft(filetype, config)
end
-- Only load plugins and colorscheme when --noplugin arg is not present
if not require("core.utils").noplugin then
require("lazy").setup(vim.tbl_values(Ice.plugins), Ice.lazy)
local pattern = "IceAfter transparent"
if Ice.plugins["nvim-transparent"].enabled == false then
pattern = "VeryLazy"
end
vim.api.nvim_create_autocmd("User", {
once = true,
pattern = pattern,
callback = function()
local rtp_plugin_path = vim.fs.joinpath(vim.opt.packpath:get()[1], "plugin")
local dir = vim.uv.fs_scandir(rtp_plugin_path)
if dir ~= nil then
while true do
local plugin, entry_type = vim.uv.fs_scandir_next(dir)
if plugin == nil or entry_type == "directory" then
break
else
vim.cmd(string.format("source %s/%s", rtp_plugin_path, plugin))
end
end
end
if not Ice.colorscheme then
Ice.colorscheme = "tokyonight"
local colorscheme_cache = vim.fs.joinpath(vim.fn.stdpath "data", "colorscheme")
if vim.uv.fs_stat(colorscheme_cache) then
local colorscheme_cache_file = io.open(colorscheme_cache, "r")
---@diagnostic disable: need-check-nil
local colorscheme = colorscheme_cache_file:read "*a"
colorscheme_cache_file:close()
Ice.colorscheme = colorscheme
end
end
require("plugins.utils").colorscheme(Ice.colorscheme, false)
end,
})
end
-- Prepend this to runtimepath last as it would be overridden by lazy otherwise
vim.opt.rtp:prepend(custom_path)