lazy.nvim icon indicating copy to clipboard operation
lazy.nvim copied to clipboard

feature: `restore` plugins by default

Open sigasigasiga opened this issue 1 year ago • 1 comments
trafficstars

Did you check the docs?

  • [X] I have read all the lazy.nvim docs

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

As nearly all of us, I store my dotfiles in a git repo. lock-file.json is stored under version control too. However, if I clone my setup to a new machine, open up neovim, Lazy begins to install the latest version of each plugin automatically and overwrites the lockfile.

To get the locked versions after that I need:

  1. git restore path/to/lockfile
  2. nvim -> :Lazy restore

which is quite inconvenient

Describe the solution you'd like

If lockfile exists then restore all the plugins, otherwise install the newest version. If a plugin is listed in the spec but is not in the lockfile, then install the latest version and update the lockfile

Describe alternatives you've considered

  1. git restore path/to/lockfile
  2. nvim -> :Lazy restore

Additional context

No response

sigasigasiga avatar Nov 18 '24 14:11 sigasigasiga

#1804 (How to use the Lock file when lazy.nvim loads for the first time?)

stoicon avatar Nov 28 '24 19:11 stoicon

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Dec 29 '24 02:12 github-actions[bot]

it has 3 likes and i think we need this

sigasigasiga avatar Dec 29 '24 02:12 sigasigasiga

#1279 ?

kyoh86 avatar Dec 29 '24 02:12 kyoh86

If lockfile exists then restore all the plugins, otherwise install the newest version. If a plugin is listed in the spec but is not in the lockfile, then install the latest version and update the lockfile

That's already how it works. Install missing always uses the lock file.

If you however do Lazy install, then it will not use the lock file.

folke avatar Jan 04 '25 05:01 folke

That's already how it works. Install missing always uses the lock file.

That's not true. For me on lazy.nvim commit d8f26efd456190241afd1b0f5235fe6fdba13d4a, it always updates other plugins after auto-intall and changes the whole lock file.

Bekaboo avatar Jan 23 '25 07:01 Bekaboo

@Bekaboo there were already multiple issues opened about this you can surely find how things are supposed to work there

max397574 avatar Jan 23 '25 07:01 max397574

@Bekaboo there were already multiple issues opened about this you can surely find how things are supposed to work there

Yes but many of them are closed as not planned including #1279 and I found no way to prevent lazy.nvim from changing the lock file after auto-install.

Bekaboo avatar Jan 23 '25 07:01 Bekaboo

they are closed as not planned because things are working as intended

max397574 avatar Jan 23 '25 07:01 max397574

I observed that the update of the lock file is due to the changes of lazy.nvim itself, nor the other plugins.

diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json
index 1fc8cc7..00353b1 100644
--- a/.config/nvim/lazy-lock.json
+++ b/.config/nvim/lazy-lock.json
@@ -8,7 +8,7 @@
   "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
   "cmp-snippy": { "branch": "master", "commit": "6e39210aa3a74e2bf6462f492eaf0d436cd2b7d3" },
   "copilot.lua": { "branch": "master", "commit": "f8d8d872bb319f640d5177dad5fbf01f7a16d7d0" },
-  "lazy.nvim": { "branch": "main", "commit": "7967abe55752aa90532e6bb4bd4663fe27a264cb" },
+  "lazy.nvim": { "branch": "main", "commit": "7e6c863bc7563efbdd757a310d17ebc95166cef3" },
   "lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" },
   "mason-lspconfig.nvim": { "branch": "main", "commit": "4d0e5b49363cac187326998b96aa6a2884e0e89b" },
   "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },

It would be appreciated if the lazy.nvim itself could be restored as well.

From https://github.com/folke/lazy.nvim/issues/1279#issuecomment-2635769792

Wsine avatar Feb 05 '25 06:02 Wsine