MarcWeber / vim-addon-manager

manage and install vim plugins (including their dependencies) in a sane way. If you have any trouble contact me. Usually I reply within 24 hours
Other
660 stars 59 forks source link

"post-install-hook" doesn't run on activate #141

Closed dbarnett closed 10 years ago

dbarnett commented 10 years ago

The help says

Hook              Case ~
post-install      After successfully installing a plugin using 
                  |:ActivateAddons| or running |:RunInstallHooks|.

but post-install-hook commands seem to only be run after :InstallAddons, and only if the addon wasn't already installed.

Is this a bug in the code or documentation?

dbarnett commented 10 years ago

If "post-install-hook" really is only intended to run after successful plugin installation, it would be extremely handy to add a "post-activate-hook" that runs on activate.

I'm from the google/maktaba team and I discovered that VAM and the addon-info.json spec would be brilliant for managing plugins built on maktaba. maktaba does some initialization of its own for newly-activated plugins, and a "post-activate-hook" would allow us to kick off that initialization.

ZyX-I commented 10 years ago

This hook must not run on :InstallAddons. It should be run on :ActivateAddons if and only if plugin is going to be installed as stated in documentation.

Post activate hook will not be added. :ActivateAddons does little more then modifying runtimepath setting if vim has not already fully started and sources plugin files if vim has already started (see :h startup, search for has("vim_starting")). Thus most likely hook will be run in wrong time. We can add a hook that will run either on VimEnter event or after plugin files were sourced (if they are sourced by VAM), but we cannot add a hook that is run just after plugin files were sourced.

Wondering what initialization do you need that has to be run on each plugin activation.


If you want to say that after calling vam#ActivateAddons or :ActivateAddons hook does not run then please provide an example (i.e. a plugin which has hook definition, but this hook is not run; and exactly how did you install and activate it). If you want to add a new hook you should open a separate issue.

dbarnett commented 10 years ago

I guess I misspoke when I mentioned :InstallAddons. I wasn't able to trigger it on a plugin I was working on locally since it was on my filesystem and always considered already "installed". I was trying to figure out how it worked reading the code.

Filed a separate feature request for "post-activate-hook" at #142.