Giter VIP home page Giter VIP logo

Comments (12)

junegunn avatar junegunn commented on August 15, 2024

Thanks. I've given thought about it but haven't decided which would be the nicest way to support this.

We could add an option for each Plug command.

Plug 'foo/bar', { 'on_update': './configure && make -j 4' }
Plug 'foo/bar', { 'on_update': function('BarUpdate') }

" Hmm, I prefer shorter option names, how about:
Plug 'foo/bar', { 'do': './configure && make -j 4' }
Plug 'foo/bar', { 'do': function('BarUpdate') }

Or/and we could support a global callback for updates. This can be a bit more verbose, but gives us greater flexibility (though I'm not sure if it's needed)

function! PlugUpdated(updated_plugins)
  for name in a:updated_plugins
    if name == 'bar'
    " ...
    endif
  endfor

  " Do something only when both foo and bar are updated
  if has_key(a:updated_plugs, 'foo') && has_key(a:updated_plugs, 'bar')
    " ...
  endif

  " Or you could log the list to some other file, etc.
endfunction

let g:plug_callback = function('PlugUpdated')

Another question is if we should parallelize the execution of callbacks or not. I'm not so sure if it's perfectly safe to do so when the callback is given as a reference to Vim function.

from vim-plug.

RobertAudi avatar RobertAudi commented on August 15, 2024

I like the first option better. Contrarily to the second option, it respects vim-plug's philosophy about simplicity. In my opinion, if a user needs more control then NeoBundle might be a better solution.

from vim-plug.

junegunn avatar junegunn commented on August 15, 2024

Another option is to expose the list of the updated plugins as a global variable, such as g:plug_updated so that the user can automate the process using it.

from vim-plug.

junegunn avatar junegunn commented on August 15, 2024

Makes sense. Well, then as the first step, I'll consider adding support for Plug 'foo/bar', { 'do': 'make' } (no support for vim funcref at this phase).

from vim-plug.

RobertAudi avatar RobertAudi commented on August 15, 2024

Sounds good to me 👍

from vim-plug.

junegunn avatar junegunn commented on August 15, 2024

Could you update and check if it works as expected? Note that both string and funcref are supported, and the execution is not parallelized.

from vim-plug.

RobertAudi avatar RobertAudi commented on August 15, 2024

Sorry for the delay. Just tried it. Seems like it works! However, the progress feedback is "poor". Even though the hook was running in the background, MacVim was frozen, and I had no clue what was actually happening. What would be better would be to maybe increase the refresh rate of the progress updates.

from vim-plug.

junegunn avatar junegunn commented on August 15, 2024

Actually there is no progress update for the hooks yet. Real-time, on-buffer progress update is only possible with parallel installer written in Ruby, so if we want it I have to write it in Ruby. But at the same time I have to maintain non-parallel installer in Vimscript to behave exactly the same as the parallel one and it's a burdensome task. So just I wrote it in Vimscript to share the implementation instead of writing two versions.

But I have an idea. If we could give up "on-buffer" update, I can replace system() call to :!, so that it prints out the progress. I'll update and let you know.

from vim-plug.

junegunn avatar junegunn commented on August 15, 2024

Updated. Now we can see the progress of the hooks, although it doesn't update the buffer.

from vim-plug.

RobertAudi avatar RobertAudi commented on August 15, 2024

Just tried it. I'm good with the result, at least there is some visibility on what's happening. 👍

from vim-plug.

junegunn avatar junegunn commented on August 15, 2024

Okay, thanks for your suggestion and feedback. 😃
Let me know if you have any problem.

from vim-plug.

junegunn avatar junegunn commented on August 15, 2024

FYI, I updated the funcref for post-update hook to take an argument to allow more control over the process: see https://github.com/junegunn/vim-plug#post-installationupdate-hooks

from vim-plug.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.