diff --git a/lua/config/plugins.lua b/lua/config/plugins.lua index 03243d3..82e176f 100644 --- a/lua/config/plugins.lua +++ b/lua/config/plugins.lua @@ -74,6 +74,17 @@ local function sync_packages() print("Install all packages...") vim.pack.add(package_list) print("All packages installed!") + -- packages removed from package_list are left on disk by vim.pack (never + -- deleted automatically) and stay "inactive"; update() below would otherwise + -- keep re-adding their stale lock file entry on every sync, see nvim-web-devicons + local inactive = vim.iter(vim.pack.get()) + :filter(function(pkg) return not pkg.active end) + :map(function(pkg) return pkg.spec.name end) + :totable() + if #inactive > 0 then + print("Prune orphaned: " .. table.concat(inactive, ", ")) + vim.pack.del(inactive) + end -- update() normally opens a confirmation buffer (:write applies it); in headless -- mode (README setup command) that buffer would just be discarded, so apply directly vim.pack.update(nil, { force = #vim.api.nvim_list_uis() == 0 }) diff --git a/nvim-pack-lock.json b/nvim-pack-lock.json index 24abcd4..0631d2e 100644 --- a/nvim-pack-lock.json +++ b/nvim-pack-lock.json @@ -77,10 +77,6 @@ "rev": "851e865342e5a4cb1ae23d31caf6e991e1c99f1e", "src": "https://github.com/nvim-treesitter/nvim-treesitter-textobjects.git" }, - "nvim-web-devicons": { - "rev": "09d1324e264c6950262dbe02a9bce2933a6800db", - "src": "https://github.com/nvim-tree/nvim-web-devicons.git" - }, "obsidian.nvim": { "rev": "bf1616d46e72477ad978051363fdb5c839c1cce5", "src": "https://github.com/obsidian-nvim/obsidian.nvim.git"