Skip to content

Commit f6ad356

Browse files
committed
refactor(nvim): migrate from lazy.nvim to built-in vim.pack
Replace lazy.nvim plugin manager with Neovim's native vim.pack API, remove the Snacks dashboard, and disable unused built-in plugins directly via vim.g variables.
1 parent 09300e4 commit f6ad356

3 files changed

Lines changed: 30 additions & 60 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
tmp/
2+
nvim-pack-lock.json

home/.config/nvim/init.lua

Lines changed: 29 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ map("n", "<Esc>", function()
5959
return "<Esc>"
6060
end, { expr = true, desc = "Escape and clear search highlight" })
6161

62-
map("n", "<Leader>lz", "<Cmd>Lazy<CR>", { desc = "Open lazy" })
62+
map("n", "<Leader>pu", function()
63+
vim.pack.update()
64+
end, { desc = "Update plugins" })
6365

6466
vim.api.nvim_create_autocmd("TextYankPost", {
6567
group = vim.api.nvim_create_augroup("UserHighlight", { clear = true }),
@@ -68,43 +70,32 @@ vim.api.nvim_create_autocmd("TextYankPost", {
6870
end,
6971
})
7072

71-
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
72-
if not vim.uv.fs_stat(lazypath) then
73-
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
74-
vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
75-
end
76-
vim.opt.rtp:prepend(lazypath)
77-
78-
local plugins = {
79-
{ "saghen/blink.cmp", version = "*" },
80-
{ "stevearc/conform.nvim" },
81-
{ "lewis6991/gitsigns.nvim" },
82-
{ "neovim/nvim-lspconfig" },
83-
{ "nvim-treesitter/nvim-treesitter", build = ":TSUpdate" },
84-
{ "stevearc/oil.nvim" },
85-
{ "folke/snacks.nvim", priority = 1000 },
86-
}
87-
88-
local lazy_opts = {
89-
rocks = { enabled = false },
90-
install = { colorscheme = { "flexoki" } },
91-
ui = { border = "rounded" },
92-
change_detection = { notify = false },
93-
performance = {
94-
rtp = {
95-
disabled_plugins = {
96-
"gzip",
97-
"netrwPlugin",
98-
"tarPlugin",
99-
"tohtml",
100-
"tutor",
101-
"zipPlugin",
102-
},
103-
},
104-
},
105-
}
106-
107-
require("lazy").setup(plugins, lazy_opts)
73+
vim.g.loaded_gzip = 1
74+
vim.g.loaded_netrwPlugin = 1
75+
vim.g.loaded_tarPlugin = 1
76+
vim.g.loaded_tohtml = 1
77+
vim.g.loaded_tutor = 1
78+
vim.g.loaded_zipPlugin = 1
79+
80+
vim.api.nvim_create_autocmd("PackChanged", {
81+
desc = "Run :TSUpdate after nvim-treesitter install/update",
82+
callback = function(ev)
83+
local data = ev.data
84+
if data.spec.name == "nvim-treesitter" and (data.kind == "install" or data.kind == "update") then
85+
vim.cmd("TSUpdate")
86+
end
87+
end,
88+
})
89+
90+
vim.pack.add({
91+
{ src = "https://github.com/folke/snacks.nvim" },
92+
{ src = "https://github.com/saghen/blink.cmp", version = vim.version.range("*") },
93+
{ src = "https://github.com/stevearc/conform.nvim" },
94+
{ src = "https://github.com/lewis6991/gitsigns.nvim" },
95+
{ src = "https://github.com/neovim/nvim-lspconfig" },
96+
{ src = "https://github.com/nvim-treesitter/nvim-treesitter" },
97+
{ src = "https://github.com/stevearc/oil.nvim" },
98+
})
10899

109100
require("config.snacks")
110101
require("config.blink")

home/.config/nvim/lua/config/snacks.lua

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,6 @@
1-
local header = [[
2-
███ ██ ███████ ██████ ██ ██ ██ ███ ███
3-
████ ██ ██ ██ ██ ██ ██ ██ ████ ████
4-
██ ██ ██ █████ ██ ██ ██ ██ ██ ██ ████ ██
5-
██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██
6-
██ ███ ███████ ██████ ████ ██ ██ ██]]
7-
81
require("snacks").setup({
92
explorer = {},
103
toggle = {},
11-
dashboard = {
12-
preset = {
13-
header = header,
14-
-- stylua: ignore
15-
keys = {
16-
{ icon = "", key = "f", desc = "Find File", action = "<Leader>ff" },
17-
{ icon = "", key = "n", desc = "New File", action = ":ene | startinsert" },
18-
{ icon = "", key = "g", desc = "Find Text", action = "<Leader>sg" },
19-
{ icon = "", key = "r", desc = "Recent Files", action = "<Leader>fr" },
20-
{ icon = "󰒲 ", key = "l", desc = "Lazy", action = ":Lazy" },
21-
{ icon = "", key = "q", desc = "Quit", action = ":qa" },
22-
},
23-
},
24-
},
254
picker = {
265
hidden = true,
276
sources = {
@@ -81,7 +60,6 @@ map("n", "<Leader>sj", function() Snacks.picker.jumps() end, { desc = "Search ju
8160
map("n", "<Leader>sk", function() Snacks.picker.keymaps() end, { desc = "Search keymaps" })
8261
map("n", "<Leader>sm", function() Snacks.picker.marks() end, { desc = "Search marks" })
8362
map("n", "<Leader>sM", function() Snacks.picker.man() end, { desc = "Search man pages" })
84-
map("n", "<Leader>sp", function() Snacks.picker.lazy() end, { desc = "Grep plugin spec" })
8563
map("n", "<Leader>sq", function() Snacks.picker.qflist() end, { desc = "Search quickfix list" })
8664
map("n", "<Leader>sr", function() Snacks.picker.resume() end, { desc = "Search resume" })
8765
map("n", "<Leader>su", function() Snacks.picker.undo() end, { desc = "Search undo history" })

0 commit comments

Comments
 (0)