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

feature: Allow updating local plugins with a url specified

Open mehalter opened this issue 2 years ago • 4 comments

Did you check the docs?

  • [X] I have read all the lazy docs

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

I have some plugins that I have downloaded in different locations that I currently have set up with dir. They are still on GitHub for example but just for my own organization of these I have them in different locations than the dev folder and the normal installation folder of plugins. It would be nice to allow the updater to still work on a plugin defined with dir as long as a url is specified.

Describe the solution you'd like

If a plugin is defined with dir = string and url = string then allow it to be updated just like a normally installed plugin while respecting things such as version/branch/etc.

Describe alternatives you've considered

The dev feature is nice and is a good alternative, but I think this would be a logical addition since having a directory and a fully specified URL should be enough to allow updates to be fetched and applied.

Additional context

No response

mehalter avatar Jan 04 '23 13:01 mehalter

I dont think this is a good idea. fyi, dev plugins are also not managed by lazy. Only remote plugins.

folke avatar Jan 04 '23 13:01 folke

Hm I see, is there a reason for this in general? Like if I specify a url explicitly wouldn't that tell Lazy that it is a remote plugin I just want that one plugin to be cloned in a different location?

Just to be clear, if a url is not specified it should be assumed that it isn't a remote plugin, but it seems logical that by giving a remote location then it is no longer considered "local".

mehalter avatar Jan 04 '23 13:01 mehalter

or it could be done with pin = true is default for dev and dir defined plugins since Lazy does automatically identify remote locations if the plugin is in a git directory. Then you could manually specify pin = false to say that you want to let lazy to be allowed to update it since it has all of the information needed to run the updater

mehalter avatar Jan 04 '23 13:01 mehalter

Allright, I'll think about it. But I'm very hesitant to add this since lazy's update code doesn't just do a git pull. It does a git fetch followed by git checkout to the exact commit that was targeted by tag, commit, pin, version, branch, ...

So that means that plugin dirs are always in a detached HEAD state. Which is not ideal for local plugins...

folke avatar Jan 04 '23 13:01 folke

Because of the reasons I listed above, I don't thing this is a good idea. Updating local plugins would also need another way to update them compared to remote plugins, which is far from ideal. I'd rather keep it simple in that local plugins should always be managed by the user.

folke avatar Jan 05 '23 13:01 folke