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

PaqSync command #51

Closed
cloudlena opened this issue Jul 7, 2021 · 2 comments
Closed

PaqSync command #51

cloudlena opened this issue Jul 7, 2021 · 2 comments

Comments

@cloudlena
Copy link

It would be great to have a PaqSync command just like PackerSync as described here: https://github.com/wbthomason/packer.nvim#quickstart

This command would be equivalent to first running PaqInstall, the PaqClean and then PaqUpdate.

Furthermore, it would be nice to have a PaqSync! command that runs the whole thing non-interactively to make it easier to use in automation scripts.

@savq
Copy link
Owner

savq commented Jul 7, 2021

Adding PaqSync is really easy, but using it non-interactively isn't, for some very annoying reasons.

The libuv wrapper that neovim uses has a very unstructured async mechanism. You can pass callbacks to an async operation, but you can't await/return values. It's just callback hell.

Paq deals with this by… not dealing with it. There are callbacks to print back info to the prompt, but the logic to check whether all operations are finished is very limited. So if you were run

nvim --headless -c 'PaqSync'

There would be no way to assert that all updates have completed (so that it quits and continues with the rest of a script or whatever).

Packer does have it's own async library to deal with this, so these limitations aren't a problem there, but I don't know if there are ways to expose it to the user.

Plenary also has utilities for async operations, and I'd be great if these were added to core Neovim.

Since Paq is about using built-in features and keeping a small feature set (for better or worse), I think this is out scope.

@savq savq mentioned this issue Jul 7, 2021
Merged
@cloudlena
Copy link
Author

Thanks, @savq for implementing the PacSync command so quickly and thoroughly explaining the reasoning about non-interactive commands!

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