Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: Install to lockfile when missing #138

Closed
1 task done
EdenEast opened this issue Dec 23, 2022 · 4 comments · Fixed by #244
Closed
1 task done

feature: Install to lockfile when missing #138

EdenEast opened this issue Dec 23, 2022 · 4 comments · Fixed by #244
Labels
enhancement New feature or request

Comments

@EdenEast
Copy link
Contributor

Did you check docs the docs?

  • I have read all the lazy docs

Is your feature request related to a problem? Please describe.

install.missing is great and keeps my config from breaking saying that a plugin is missing and not installed. However when it checks missing it calls the install. Install does not take the lockfile into account.

if Config.options.install.missing then
Util.track("install")
for _, plugin in pairs(Config.plugins) do
if not plugin._.installed then
for _, colorscheme in ipairs(Config.options.install.colorscheme) do
if pcall(vim.cmd.colorscheme, colorscheme) then
break
end
end
require("lazy.manage").install({ wait = true })

The result is that the plugin will be installed at the latest commit. Also now that install calls update on the lockfile then lockfile will be updated with the latest change.

Describe the solution you'd like

Having an option to tell install that I would like to install to the the commit specified in the lockfile if it exists.

Describe alternatives you've considered

I tried to set install.missing = false and then call restore manually but when launching nvim it fails loading my config saying that everything does not exist.

Additional context

No response

@EdenEast EdenEast added the enhancement New feature or request label Dec 23, 2022
@folke
Copy link
Owner

folke commented Dec 23, 2022

This is a very specific use-case. What you can do:

  • let lazy install everything
  • revert the lockfile to what you had in git
  • run lazy restore

@folke folke closed this as completed Dec 23, 2022
@EdenEast
Copy link
Contributor Author

I disagree, and would argue that this is the default case. As there is a lockfile I would expect that the version that is specified in the lock file would be set when doing operations like installing.

folke added a commit that referenced this issue Dec 30, 2022
@folke
Copy link
Owner

folke commented Dec 30, 2022

After thinking about it more, you are right.

I just pushed an update so that missing plugins will always be installed with the existing commit in the lockfile.

@atinylittleshell
Copy link

atinylittleshell commented Dec 27, 2023

@folke it looks like the behavior regressed. Whenever lazy auto installs a missing plugin it would install the latest commit and change the lockfile instead of respecting it. This kind of defeats the purpose of the lockfile IMO.

I have multiple devices and environments that share the same dot files, and I generally don't want to update my plugins (to avoid dealing with breaking changes when I just need my editor to work). This behavior would basically keep updating my plugins whenever I start nvim on a device that hasn't got some of the plugins yet - quite an inconvenience to deal with..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants