vim.pack
Methods5
function M.add(specs: string | vim.pack.Spec[], opts: vim.pack.keyset.add | nil) -> nil
Add plugin to current session
- For each specification check that plugin exists on disk in |vim.pack-directory|:
- If exists, check if its
srcis the same as input. If not - delete - If doesn't exist, install it by downloading from
srcintoname - For each plugin execute |:packadd| (or customizable
loadfunction) making
immediately to clean install from the new source. Otherwise do nothing.
subdirectory (via partial blobless git clone) and update revision to match version (via git checkout). Plugin will not be on disk if any step resulted in an error.
it reachable by Nvim.
Notes:
- Installation is done in parallel, but waits for all to finish before
- If plugin is already present on disk, there are no checks about its current revision.
- Adding plugin second and more times during single session does nothing:
continuing next code execution.
The specified version can be not the one actually present on disk. Execute |vim.pack.update()| to synchronize.
only the data from the first adding is registered.
specsstring | vim.pack.Spec[]List of plugin specifications. String item is treated as
src.optsvim.pack.keyset.add | nil
- nil
function M.update(names: string[] | nil, opts: vim.pack.keyset.update | nil) -> nil
Update plugins
- Download new changes from source.
- Infer update info (current/target revisions, changelog, etc.).
- If
forceisfalse(default), show confirmation buffer.
If force is true, make updates right away.
Notes:
- Every actual update is logged in "nvim-pack.log" file inside "log" |standard-path|.
- It doesn't update source's default branch if it has changed (like from
mastertomain).
To have version = nil point to a new default branch, re-install the plugin (|vim.pack.del()| + |vim.pack.add()|).
Confirmation buffer ~
The goal of the confirmation buffer is to show update details for the user to read, confirm (execute |:write|) or deny (execute |:quit|) the update.
Pending changes starting with > will be applied while the ones starting with < will be reverted.
There are convenience buffer-local mappings:
- |]]| and |[[| to navigate through plugin sections.
Some features are provided via LSP:
- 'textDocument/documentLink' - compute links for plugin paths, sources,
- 'textDocument/documentSymbol' (
gOvia |lsp-defaults| or |vim.lsp.buf.document_symbol()|) - - 'textDocument/hover' (
Kvia |lsp-defaults| or |vim.lsp.buf.hover()|) - show more - 'textDocument/codeAction' (
gravia |lsp-defaults| or |vim.lsp.buf.code_action()|) - show
commits, and tags. Makes a best effort educated guess about a link structure. Use |gx| to open a link to an object at cursor.
show structure of the buffer.
information at cursor. Like details of particular pending change or newer tag.
code actions relevant for "plugin at cursor". Like "delete" (after extra confirmation for active plugins), "update" or "skip updating" (if there are pending updates).
namesstring[] | nilList of plugin names to update. Must be managed by |vim.pack|, not necessarily already added to current session. Default: names of all plugins managed by |vim.pack|.
optsvim.pack.keyset.update | nil
- nil
function M.del(names: string[], opts: vim.pack.keyset.del | nil) -> nil
Remove plugins from disk
namesstring[]List of plugin names to remove from disk. Must be managed by |vim.pack|, not necessarily already added to current session.
optsvim.pack.keyset.del | nil
- nil
function M.get(names: string[] | nil, opts: vim.pack.keyset.get | nil) -> vim.pack.PlugData[]
Gets |vim.pack| plugin info, optionally filtered by names.
namesstring[] | nilList of plugin names. Default: all plugins managed by |vim.pack|.
optsvim.pack.keyset.get | nil
function M._get_names(skip_inactive: nil | boolean) -> plugin_names string[]
Fields1
M._plugin_lock_path : string