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: Lazy update on plugins file save? #966

Closed
1 task done
y0nei opened this issue Aug 1, 2023 · 1 comment
Closed
1 task done

feature: Lazy update on plugins file save? #966

y0nei opened this issue Aug 1, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@y0nei
Copy link

y0nei commented Aug 1, 2023

Did you check the docs?

  • I have read all the lazy.nvim docs

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

I always like when nvim automatically updates/installs the packages after my plugins file update, it saves a ton of time. Would be very happy if anybody could help me out

Describe the solution you'd like

I would like to run :Lazy update / require("lazy").update() upon file save

Describe alternatives you've considered

I have tried a solution inspired by packer.nvim to this:

vim.cmd([[
    augroup packer_user_config
        autocmd!
        autocmd BufWritePost plugins.lua source <afile> | PackerSync
    augroup end
]])

And modified it to fit lazy.nvim

vim.cmd([[
    augroup lazy_user_config
        autocmd!
        autocmd BufWritePost plugins.lua | Lazy update
        " or autocmd BufWritePost plugins.lua call require("lazy").update()
    augroup end
]])

Note that i removed source <afile> since i get Re-sourcing your config is not supported with lazy.nvim
This works perfectly fine but im getting a confirmation prompt to run the Lazy update command:

"lua/core/plugins.lua" 23L, 438B written
23 })  <-- This output of the line the cursor was last at before saving
Press ENTER or type command to continue

Additional context

No response

@y0nei y0nei added the enhancement New feature or request label Aug 1, 2023
@folke
Copy link
Owner

folke commented Aug 1, 2023

This is not something I want to add to lazy. Ask in discussions instead to see if someone can help you get your code right

@folke folke closed this as not planned Won't fix, can't repro, duplicate, stale Aug 1, 2023
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

No branches or pull requests

2 participants