docs: drop vim.pack WIP note, add example code #37229

This commit is contained in:
Evgeni Chasnovski
2026-01-08 04:43:55 +02:00
committed by GitHub
parent 0bd4d3f779
commit 3e83f7bec7
2 changed files with 21 additions and 6 deletions

View File

@@ -207,8 +207,8 @@ sourcing the plugins.
==============================================================================
Plugin manager *vim.pack*
WORK IN PROGRESS built-in plugin manager! Early testing of existing features
is appreciated, but expect breaking changes without notice.
Install, update, and delete external plugins. WARNING: It is still considered
experimental, yet should be stable enough for daily use.
Manages plugins only in a dedicated *vim.pack-directory* (see |packages|):
`$XDG_DATA_HOME/nvim/site/pack/core/opt`. `$XDG_DATA_HOME/nvim/site` needs to
@@ -342,7 +342,13 @@ Remove plugins from disk ~
• Remove plugin specs from |vim.pack.add()| calls in 'init.lua' or they will
be reinstalled later.
• |:restart|.
• Use |vim.pack.del()| with a list of plugin names to remove.
• Use |vim.pack.del()| with a list of plugin names to remove. Use
|vim.pack.get()| to get all non-active plugins: >lua
vim.iter(vim.pack.get())
:filter(function(x) return not x.active end)
:map(function(x) return x.spec.name end)
:totable()
<
*vim.pack-events*
• *PackChangedPre* - before trying to change plugin's state.
@@ -363,6 +369,7 @@ These events can be used to execute plugin hooks. For example: >lua
-- Run build script after plugin's code has changed
if name == 'plug-1' and (kind == 'install' or kind == 'update') then
-- Append `:wait()` if you need synchronous execution
vim.system({ 'make' }, { cwd = ev.data.path })
end

View File

@@ -1,7 +1,7 @@
--- @brief
---
---WORK IN PROGRESS built-in plugin manager! Early testing of existing features
---is appreciated, but expect breaking changes without notice.
--- Install, update, and delete external plugins. WARNING: It is still considered
--- experimental, yet should be stable enough for daily use.
---
---Manages plugins only in a dedicated [vim.pack-directory]() (see |packages|):
---`$XDG_DATA_HOME/nvim/site/pack/core/opt`. `$XDG_DATA_HOME/nvim/site` needs to
@@ -149,7 +149,14 @@
---- Remove plugin specs from |vim.pack.add()| calls in 'init.lua' or they will be
--- reinstalled later.
---- |:restart|.
---- Use |vim.pack.del()| with a list of plugin names to remove.
---- Use |vim.pack.del()| with a list of plugin names to remove. Use |vim.pack.get()|
--- to get all non-active plugins:
---```lua
---vim.iter(vim.pack.get())
--- :filter(function(x) return not x.active end)
--- :map(function(x) return x.spec.name end)
--- :totable()
---```
---
---[vim.pack-events]()
---
@@ -172,6 +179,7 @@
---
--- -- Run build script after plugin's code has changed
--- if name == 'plug-1' and (kind == 'install' or kind == 'update') then
--- -- Append `:wait()` if you need synchronous execution
--- vim.system({ 'make' }, { cwd = ev.data.path })
--- end
---