Skip to content

More strict behavior of vim.pack.add() #34771

@echasnovski

Description

@echasnovski

There are several areas where behavior of vim.pack.add() can be improved:

  1. Make it enforce plugin state on disk to be the one specified in plugin spec. I.e. enforce spec.src and spec.version. This allows a more straightforward switching to different branch/tag/version: edit 'init.lua' and :restart. Currently it requires extra step of vim.pack.update() (which needs internet connection) to "sync" plugin on disk with to have proper version.

    To not affect startup performance, this requires having a persistent on-disk storage of the plugin state (to be able to even detect the value change).

    The cost of this "enforce state" approach is that users can not see beforehand and confirm/deny which changes will be applied. They would still be present in the log file for inspection, though. Relevant discussion is here.

  2. Decide how to treat several vim.pack.add() calls for the same plugin in the same session. Should it always force the state on disk or should it error for any second+ call for the same plugin (forcing to go "edit init.lua and restart" route)?

Metadata

Metadata

Assignees

Labels

luastdlibpackagesvim.pack, start/opt packages, 'packpath'

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions