-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.lua
More file actions
79 lines (73 loc) · 2.18 KB
/
init.lua
File metadata and controls
79 lines (73 loc) · 2.18 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
local function load_env()
local env_file = vim.fn.stdpath("config") .. "/.env"
if vim.fn.filereadable(env_file) == 1 then
for line in io.lines(env_file) do
-- Skip empty lines and comments
if line:match("^%s*$") == nil and line:match("^%s*#") == nil then
local key, value = line:match("^([%w_]+)%s*=%s*(.+)$")
if key and value then
-- Remove quotes if present
value = value:gsub("^['\"]", ""):gsub("['\"]$", "")
vim.env[key] = value
end
end
end
end
end
load_env()
-- Bootstrap lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local out = vim.fn.system({
"git", "clone", "--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable",
lazypath,
})
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
-- Load core config (options sets leader keys)
require("config.options")
-- Plugins that should load in VSCode (whitelist approach)
local vscode_enabled = {
"lazy.nvim",
"nvim-treesitter",
"nvim-treesitter-textobjects",
"mini.surround",
"nvim-autopairs",
"which-key.nvim",
}
-- Setup plugins
require("lazy").setup({
spec = {
{ import = "plugins" },
},
defaults = {
cond = function(plugin)
-- Always load outside VSCode
if not vim.g.vscode then return true end
-- In VSCode: only load whitelisted plugins or those marked vscode=true
return vim.tbl_contains(vscode_enabled, plugin.name) or plugin.vscode
end,
},
install = { colorscheme = { "catppuccin", "habamax" } },
checker = { enabled = not vim.g.vscode, notify = true },
change_detection = { enabled = not vim.g.vscode, notify = false },
-- ui = { border = "rounded" },
})
-- Load keymaps and autocmds
require("config.keymaps")
require("config.autocmds")
-- Load VSCode-specific config when running in VSCode
if vim.g.vscode then
require("config.vscode")
end