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: provide a convenient way to apply patches to plugins #877

Closed
1 task done
Bekaboo opened this issue Jun 17, 2023 · 3 comments · Fixed by #870
Closed
1 task done

feature: provide a convenient way to apply patches to plugins #877

Bekaboo opened this issue Jun 17, 2023 · 3 comments · Fixed by #870
Labels
enhancement New feature or request

Comments

@Bekaboo
Copy link

Bekaboo commented Jun 17, 2023

Did you check the docs?

  • I have read all the lazy.nvim docs

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

Hi folke, thanks for your work on this plugin!

I'm aware of the existence of dev and dir=... options that can be used to manage local plugins, but in sometimes I just want to apply a few small changes to the plugin before my changes get merged to the upstream, where I prefer to use git patches to change the plugins locally without having to change the repo url in the plugins specs.

Currently I use the build option to do this:

{
  'foo/bar',
  build = 'git apply '
    .. vim.fn.stdpath('config')
    .. '/patches/bar.patch',
}

but when I upgrade the plugin, because of the existence of the local changes, git checkout will fail.

I wonder if lazy.nvim can provide an option in the plugin spec called patch that accepts a string as the path to the patch.

If patch is specified, lazy.nvim should

  • apply the patch before running build
  • on updating, revert the patch first, then update and plugin and tries to reapply the patch
    • lazy.nvim should throw error if the patch cannot be applies to the new version of the plugin, else update the plugin normally

Describe the solution you'd like

lazy.nvim can provide an option in the plugin spec called patch that accepts a string (as the path to the patch) or a function (that can be used to apply the patch).

If patch is specified, lazy.nvim should

  • apply the patch before running build
  • on updating, revert the patch first, then update and plugin and tries to reapply the patch
    • lazy.nvim should throw error if the patch cannot be applies to the new version of the plugin, else update the plugin normally

Describe alternatives you've considered

N/A

Additional context

No response

@Bekaboo Bekaboo added the enhancement New feature or request label Jun 17, 2023
@folke
Copy link
Owner

folke commented Jun 17, 2023

I'm not interested as having this in lazy

@folke folke closed this as not planned Won't fix, can't repro, duplicate, stale Jun 17, 2023
@Bekaboo
Copy link
Author

Bekaboo commented Jun 17, 2023

@folke Thanks for your reply.

Can we instead add some new user events such as LazySyncPre or LazyUpdatePre besides LazySync, LazyUpdate, etc so that users can take advantage of these events to achieve what is described above?

folke added a commit that referenced this issue Jun 17, 2023
@folke
Copy link
Owner

folke commented Jun 17, 2023

Just added this

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.

2 participants