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

Applying only once when writing multiple buffers? #16

Open
xfzv opened this issue Jul 24, 2024 · 3 comments
Open

Applying only once when writing multiple buffers? #16

xfzv opened this issue Jul 24, 2024 · 3 comments

Comments

@xfzv
Copy link

xfzv commented Jul 24, 2024

I prefer applying changes after writing buffer(s) rather than after opening a file in chezmoi source dir, so I'm using this config adapted from the README:

  {
    "xvzc/chezmoi.nvim",
    init = function()
      require("chezmoi").setup({
        vim.api.nvim_create_autocmd({ "BufWritePost" }, {
          pattern = "{{ .chezmoi.sourceDir }}/*",
          callback = function()
            vim.schedule(require("chezmoi.commands.__edit").watch)
          end,
        }),
      })
    end,
  },

I noticed that when writing multiple buffers with :wall, chezmoi.nvim will apply changes for every single buffer, e.g. if writing 7 buffers, it will apply changes 7 times (got multiple "Edit: Successfully applied" notifications).

This is obviously slower than applying once and if one's using chezmoi external like me, GitHub's rate limit could be reached rather quickly, resulting in any apply operation failing until the limit is reset.

Is there any way of applying once instead or could it be implemented somehow?

Thanks!

@xvzc
Copy link
Owner

xvzc commented Jul 25, 2024

I'm also using chezmoi externals. but this doesn't happen because we don't add the -R option when automatically apply the changes. do you by any chance have any config that automatically refreshes the externals on every apply?

@xfzv
Copy link
Author

xfzv commented Jul 25, 2024

do you by any chance have any config that automatically refreshes the externals on every apply?

No, I don't. I actually hit GitHub's rate limit while playing around with chezmoi.nvim (I got a Neovim notification telling me so after writing a buffer). But maybe this was just a coincidence, it happens to me occasionally. I ended up creating a GitHub Personal Access Token for chezmoi, I shouldn't ever get limited again.

It would be nice if apply run only once even if writing multiple buffers regardless.

@xvzc
Copy link
Owner

xvzc commented Jul 26, 2024

Okay i will take a look if there's any way to do so

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

No branches or pull requests

2 participants