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

Help with post-install/post-update #168

Closed chadrien closed 9 years ago

chadrien commented 9 years ago

In the docs, I seemed to have read that we can specify post install/update commands, but I can't make it work.

I use a scripts file (call vam#Scripts('~/.vim/vim-scripts', {'tag_regex': '.*'})) and I'm trying to make the magic happen like this:

{'name': 'vimproc', 'post-install': 'make', 'post-update': 'make'}

So basically I'd like the command make to be ran after plugin installation/update.

rm -rf ~/.vim/vim-addons/vimproc ; vim

The plugin is installed but the make command isn't called.

Am I missing something?

ZyX-I commented 9 years ago

You must

  1. Use VimL commands and not shell commands.
  2. VimL commands must not depend on the current working directory. How directory where plugin is installed to can be obtained is described in the documentation.
  3. post-install and post-update are hook names. In addon-info.json file they must be present with -hook suffix.
  4. addon-info.json is JSON file. JSON does not define single-quoted strings and, though this actually works due to currently used implementation, you should not depend on it.

And I have no idea how “you are trying to make the magic happen”. The example dictionary does not look like an addon-info file or like a change to vim-pi database.

chadrien commented 9 years ago

Hum I see.

The file I describe is not a addon-info.json but a VAM file loaded with call vam#Scripts (as I said in the issue description).

So if I got you right hooks only trigger if defined in the addon-info.json of the installed plugin, right? If so, is there a way to define these hooks from a VAM user point of view?

My precise "problem" is the following:

ZyX-I commented 9 years ago

@chadrien What is the “install plugin”? VAM has no plugins. In case plugin is missing addon-info file it may be defined in vim-pi database. You can also use your own function in place of vam_known_repositories#Pool that will e.g. call vam_known_repositories#Pool and patch the result with necessary information about hooks. Only works for plugins that miss addon-info.json file.

Another alternative are global hooks: :h VAM-post_install_hook_functions. Called functions receive enough information to limit function effect to needed plugin only.

chadrien commented 9 years ago

"install plugin" was a typo for "installed plugin" :wink:

I'll have a look to vam_known_repositories#Pool and global hooks, thanks.