Notify about available plugin updates and vim-plug upgrade #493

Open
martin-svk opened this Issue Jun 14, 2016 · 10 comments

Projects

None yet

4 participants

@martin-svk
martin-svk commented Jun 14, 2016 edited

Hi,

everyday when I start vim I firstly do :PlugUpgrade and then :PlugUpdate and usually no updates are available. If this plugin could provide an interface for statusline or use some other method (e.g. echo message) to display info (at least count) about plugins which have available updates, that would be great.

Something like 4 updates available and plug upgrade available or with less text and with use of some nice symbols. I guess this should be possible using git.

Thanks.


  • Type:
    • Bug
    • Enhancement
    • Feature Request
    • Question
  • OS:
    • All/Other
    • Linux
    • OS X
    • Windows
  • Vim:
    • Terminal Vim
    • GVim
    • Neovim
@junegunn
Owner

There is no way to know if the remote repository has been updated without contacting it. So in order to print the suggested message (x updates available), vim-plug has to fetch all the changes, which is effectively, :PlugUpdate.

@mike-zueff

@junegunn, there can be a hack solution for at least git-located VIM plug-ins. So vim-plug can execute something like
git ls-remote origin --heads refs/heads/master
once a week in order to compare that hash with the one from local .../.git/refs/heads/master for each plug-in. If the values differ then vim-plug can open a new VIM buffer with the news and the update prompt. Do you have a long-term roadmap for this feature implementation?

@mike-zueff

It would be good to get it implemented for at least automatic vim-plug self-upgrade. Some of the users do :PlugUpdate several times a month but they usually forget to run :PlugUpgrade.

@martin-svk

@junegunn I actually did a quick how to check for git remote updates google search and the result's looked promising so I tought this is possible. Also @mike-zueff has a good approach for this.

@mike-zueff Is there a reason why the hash compare should be done only once per week? This could be maybe configurable.

@Celti
Celti commented Jun 15, 2016

Dudes. Just set up a crontab for vim +PlugUpgrade +PlugUpdate +qa! and run the updates as often as you like, automatically.

@mike-zueff

@martin-svk, of course, it should be configurable.

@Celti, not a good idea, IMHO. Rationale: some plug-ins can take too long time for update. E.g., YouCompleteMe update usually triggers install.py launch and can work for about 15 minutes before the update is completed. So if the computer will be rebooted until the cron job is finished then you can get a buggy plug-in or not completely compiled one. One more argument consists in that it would be nice to control the update process ourselves and view the update summary data in the vim-plug VIM buffer when all the update jobs are completed. The silent update using cron/anacron won't show you the summary actually.

@mike-zueff

@Celti, also cron/anacron job can be launched when you'll be busy with the software development, etc. So some plug-ins may become broken after automatic update is finished or during the update process workflow. It can be much more comfortable to update all the plug-ins in the spare time or at the end of a working day nevertheless.

@Celti
Celti commented Jun 15, 2016

Have you ever worried about your computer rebooting in the middle of any other cronjob it comes with? Most Linux distros come with a number enabled by default. But if it's really a problem, have the cronjob inhibit shutdowns while it's running (c.f. molly-guard, polkit inhibitors).

The typical user of Plug, from everything I've seen, simply runs PlugUpgrade and PlugUpdate without any interactivity whatsoever, then (sometimes) reviews the buffer when done. So, dump the buffer to stdout when you're done (or simply run Vim in 'exim' mode for the job) so that cron emails you the output.

As for updates happening while you're busy with software development... you could have the cron job check for running Vim sessions and inhibit itself, but I don't think that's actually a problem โ€” once Vim is loaded, a plugin is not going to reload itself from disk unless you tell it to, therefore changing the plugin on the disk isn't going to affect your development session one iota.

None of those problems are insurmountable, or even terribly difficult to solve โ€” but they do require you to do something.

@martin-svk
martin-svk commented Jun 16, 2016 edited

@Celti None of those problems are insurmountable, or even terribly difficult to solve โ€” but they do require you to do something.

That's true. But isn't it easier to find a good way for my proposed feature to work? It's not much harder to solve and no user has to do anything like cron + molly-guard + etc. fancy stuff. I mean, almost every modern editor now displays a notification when plugin updates are available.

updates_available

@junegunn
Owner
junegunn commented Jun 16, 2016 edited

vim-plug labels itself as "minimalist plugin manager" and I'm not in favor of adding more features to it. Unlike "modern" editors, Vim is basically a single-threaded, synchronous program, and to start a background process, you'll have to use a bleeding-edge version of Vim or Neovim, while one of the strong points of vim-plug is its obsession with backward compatibility (almost all of its features work in archaic Vim 7.0 with Git 1.7)

What I'd like to stress is that, you can implement the idea as an external script, like an addon plugin. Since vim-plug exposes its data structure via g:plugs variable, you can refer to it. Or to make things simpler, you can blindly check the directories in ~/.vim/plugged in a shell script that is registered as a cron job, and display the result of it on your statusline.

If you come up with a solution, let me know. We can put it on the wiki, or if it turns out to be really nice and simple, we can then consider integrating it to the project in some way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment