kristijanhusak / vim-packager

Vim plugin manager that utilizes "jobs" and "pack" features.
MIT License
245 stars 9 forks source link

question about the post-install hooks #30

Closed jdhao closed 3 years ago

jdhao commented 3 years ago

I have a few questions regarding the value for do in packager#add() function.

  1. For nvim-gdb, it requires us to run install.sh script and :UpdateRemotePlugins command after install. Is it possible to combine the two in post update? I can't seem to get it right. For vim-plug, the following would work:
 Plug 'sakhnik/nvim-gdb', { 'do': ':!./install.sh \| UpdateRemotePlugins' }
  1. It seems that post-install hooks default to bash command. So for deoplete call packager#add('Shougo/deoplete.nvim', {'do': ':UpdateRemotePlugins'}) works, while call packager#add('Shougo/deoplete.nvim', {'do': 'UpdateRemotePlugins'}) (note that there is no colon before the UpdateRemotePlugins) does not. Is the colon a must?

Thanks for this wonderful plugin. It seems to be even faster than vim-plug. Very promising!

kristijanhusak commented 3 years ago

UpdateRemotePlugins is done automatically by vim-packager, so it should be sufficient to run only install script. Try this:

call packager#add('sakhnik/nvim-gdb', { 'do': './install.sh' })
jdhao commented 3 years ago

Thanks for the info. It works. It would be great to add that to README or the doc so that users do not need to run the 'UpdateRemotePlugins' command anymore.

Another question. For post-install hooks that need to run a function, for example [markdown-preview](), the following works:

call packager#add('iamcco/markdown-preview.nvim' , { 'do': { -> mkdp#util#install() } })

while the following command fails:

call packager#add('iamcco/markdown-preview.nvim' , { 'do': 'function(mkdp#util#install())' })

it complains that function mkdp#util#install() does not work. However I can manually run the function.

kristijanhusak commented 3 years ago

If do is a string, and it doesn't start with :, it is interpreted as external command. So you could also do it like this:

call packager#add('iamcco/markdown-preview.nvim' , { 'do': ':call mkdp#util#install()' })

I agree that we could use more info in readme. I'm open for PRs.

jdhao commented 3 years ago

Thanks for the clarification, call packager#add('iamcco/markdown-preview.nvim' , { 'do': ':call mkdp#util#install()' }) also works.

kristijanhusak commented 3 years ago

I added some examples in this section of readme: https://github.com/kristijanhusak/vim-packager#packageraddname-options. Hope it will be helpful enough.