r-darwish / topgrade

Upgrade everything
GNU General Public License v3.0
3.37k stars 162 forks source link

Can you support Packer? #974

Open tsoernes opened 1 year ago

tsoernes commented 1 year ago

I want to suggest a new step

Which tool is this about? Where is its repository?

neovim plugin manager https://github.com/wbthomason/packer.nvim

Which operating systems are supported by this tool?

What should Topgrade do to figure out if the tool needs to be invoked?

Which exact commands should Topgrade run?

:PackerSync

I want to suggest some general feature

Topgrade should...

More information

mrjones2014 commented 1 year ago

Which exact commands should Topgrade run?

More accurately, to update Packer plugins from the command line, you can do:

nvim --headless -c 'autocmd User PackerComplete quitall' -c 'PackerSync'

This will:

svenXY commented 1 year ago

did you see #756 ? packer.nvim is actually already supported, but does not correctly work. I'd love to see this working somehow, but given that due to the asynchronous way packer is run, the batch mode seems to have to be called differently, which is why the generic solution with upgrade.vim for all (n)vim package managers will likely not work

mrjones2014 commented 1 year ago

due to the asynchronous way packer is run

Yeah, the command I posted above solves this -- it opens Neovim headless, sets up an autocmd, then runs packer, so it waits for packer to finish before exiting neovim.

nvim --headless -c 'autocmd User PackerComplete quitall' -c 'PackerSync'
mrjones2014 commented 1 year ago

Oh it looks like this is pretty much what that PR is doing. I wonder why it was closed.

svenXY commented 1 year ago

because it does not work the way update.vim is constructed - nvim is always executed with the same parameters and update.vim as the file to be executed and that seems to interfere with the asynchronicity.

wbthomason commented 1 year ago

The PR also died because I didn't have time to keep debugging it at the time. It was unclear if the change I proposed to the arguments topgrade passes to Neovim actually solved the issue or merely revealed another. If you'd like to pick the PR up where I left it, it's still the basic approach I would take.

A reasonable alternative may be to define a custom command for topgrade with the command @mrjones2014 suggests above.