-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.lua
More file actions
151 lines (132 loc) · 4.62 KB
/
init.lua
File metadata and controls
151 lines (132 loc) · 4.62 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
144
145
146
147
148
149
150
151
-- Enable faster Lua module loading
vim.loader.enable()
-- Load dotgk (with wrapper for graceful degradation)
local dotgk = require("init-utils.dotgk-wrapper").get()
-- Add meta-private plugin to package path and runtime path if on Meta device
if dotgk.check "meta" then
local meta_private_base = vim.fn.expand "~/.config/nvim-meta-private"
local meta_private_lua = meta_private_base .. "/lua"
if vim.fn.isdirectory(meta_private_base) == 1 then
-- Add to runtime path for ftplugin files
vim.opt.rtp:prepend(meta_private_base)
-- Add to package path for require() calls
package.path = package.path .. ";" .. meta_private_lua .. "/?.lua;" .. meta_private_lua .. "/?/init.lua"
local ok, meta_private = pcall(require, "meta-private")
if ok then
meta_private.setup()
else
vim.notify("Meta-private plugin failed to load: " .. tostring(meta_private), vim.log.levels.WARN)
end
end
end
-- Build plugin spec table for lazy.nvim
local spec = {}
-- Load add_spec helper
local add_spec_module = require "init-utils.add-spec"
local function add_spec(item)
add_spec_module.add_spec(spec, item)
end
-- General settings
require "user.options"
require "user.keymaps"
require "user.autocommands"
require "user.filetypes"
-- Load plugins conditionally based on environment
if not vim.g.vscode then
-- UI & Theming
add_spec "user.plugins.ui.colorscheme"
add_spec "user.plugins.ui.alpha"
add_spec "user.plugins.ui.lualine"
add_spec "user.plugins.ui.bufferline"
add_spec "user.plugins.ui.webdevicons"
add_spec "user.plugins.ui.indentline"
add_spec "user.plugins.ui.tpipeline"
add_spec "user.plugins.ui.render-markdown"
add_spec "user.plugins.ui.which-key"
-- File Management
add_spec "user.plugins.files.oil"
add_spec "user.plugins.files.tv"
-- Editing
add_spec "user.plugins.editing.autopairs"
add_spec "user.plugins.editing.comment"
add_spec "user.plugins.editing.cutlass"
add_spec "user.plugins.editing.surround"
add_spec "user.plugins.editing.abolish"
add_spec "user.plugins.editing.repeat"
add_spec "user.plugins.editing.dial"
-- LSP & Diagnostics
add_spec "user.plugins.lsp.nvim-lspconfig"
add_spec "user.plugins.lsp.none-ls"
add_spec "user.plugins.lsp.nvim-lightbulb"
add_spec "user.plugins.lsp.trouble"
add_spec "user.plugins.lsp.fidget"
add_spec "user.plugins.lsp.tiny-inline-diagnostic"
add_spec "user.plugins.lsp.blink-cmp"
add_spec "user.plugins.lsp.luasnip"
-- SCM (Source Control Management)
add_spec "user.plugins.scm.gitsigns"
add_spec "user.plugins.scm.git-conflict"
add_spec "user.plugins.scm.tcr"
add_spec "user.plugins.scm.difftastic"
-- Utilities
add_spec "user.plugins.utilities.flatten"
add_spec "user.plugins.utilities.toggleterm"
add_spec "user.plugins.utilities.sidekick"
add_spec "user.plugins.utilities.haunt"
-- Try to load all Meta-specific plugins at once
local ok_meta, meta_specs = pcall(require, "meta-private.plugins")
if ok_meta and meta_specs then
for _, plugin_spec in ipairs(meta_specs) do
table.insert(spec, plugin_spec)
end
end
else
-- VSCode integration
local vscode = require "vscode"
vim.notify = vscode.notify
vim.g.clipboard = vim.g.vscode_clipboard
end
-- Core plugins (always loaded)
add_spec "user.plugins.core.plenary"
add_spec "user.plugins.core.treesitter"
add_spec "user.plugins.core.flash"
add_spec "user.plugins.core.snacks"
-- Bootstrap lazy.nvim
local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim"
if not vim.uv.fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system { "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, 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)
-- Determine lockfile based on environment
local lockfile = dotgk.check "meta/devserver" and "lazy-lock-meta-devserver.json"
or dotgk.check "meta" and "lazy-lock-meta.json"
or "lazy-lock.json"
-- Setup lazy.nvim
require("lazy").setup {
spec = spec,
defaults = {
lazy = false, -- Don't lazy-load by default (plugins opt-in to lazy loading)
},
lockfile = vim.fn.stdpath("config") .. "/" .. lockfile,
performance = {
rtp = {
disabled_plugins = {
"gzip",
"tarPlugin",
"tohtml",
"tutor",
"zipPlugin",
},
},
},
}