Comments (12)
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.
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.
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.
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.
Sounds good to me 👍
from vim-plug.
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.
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.
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.
Updated. Now we can see the progress of the hooks, although it doesn't update the buffer.
from vim-plug.
Just tried it. I'm good with the result, at least there is some visibility on what's happening. 👍
from vim-plug.
Okay, thanks for your suggestion and feedback. 😃
Let me know if you have any problem.
from vim-plug.
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)
- Manage the configs for each vim-plugged plugin in a separate file.
- On demand loading with user defined commands? HOT 2
- error message on opening .vimrc HOT 1
- Installation fails(?) on neovim 0.9.5 on Macos HOT 3
- Improve for https://github.com/junegunn/vim-plug/wiki/tips#automatic-installation-of-missing-plugins HOT 1
- Running multiple commands in after update hook HOT 2
- Add a command to return vim-plug version HOT 1
- Make automatic installation script in wiki tips compatible with Neovim HOT 8
- I think vim-plug is a very excellent Vim plug-in management tool.The codigger project has many plug-ins that extend Vim.
- Mistyping a plugin name gives a cryptic error HOT 2
- plug.vim and init.lua loading issue? HOT 1
- fugitive compatibility for viewing commits in PlugDiff HOT 2
- Allow pull with --force HOT 5
- E492 Not and Editor command on Windows HOT 2
- Failed to compare with the origin when PlugClean. HOT 7
- How do I use VIM-PLUG? Where do I put it? (I'm on Windows 10 and my main VIM folder is at C:/Program Files/Vim and I use Ubuntu to use Linux on Windows Terminal) HOT 2
- g:plug_timeout is not respected for SSL connection timeout HOT 6
- You should follow the instructions in https://github.com/junegunn/vim-plug?tab=readme-ov-file#installation
- My plugin don't work until I run PlugUpdate or PlugInstall. HOT 9
- [Fixed] Error 185 Can not Find color scheme when I use vimplug for install colorschemeS and set it in vimrc HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vim-plug.