Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide an example of how to install a package / plugin with a post-install hook #55

Open
ipatch opened this issue Jun 22, 2018 · 5 comments

Comments

@ipatch
Copy link

ipatch commented Jun 22, 2018

I've been using minpac for a little bit, and I really enjoy the simplistic nature of it, but the terse example of working with packages in the README.md that require post-install hooks comes across as a little bit confusing to me. 🤷‍♂️ I'm no Vimscript ninja by any means, but I gave it the ol college attempt at trying to understand at what is going on with setting up a package / plugin that requires a post-install hook.

Presently I'm using vim-markdown-composer to preview markdown documents that I edit via Vim and Neovim in my default browser, and vim-markdown-composer requires a working rust toolchain to compile properly. I tried a couple of scenarios to download the vim-markdown-composer package and get it to build all in one step when running PackUpdate but the only solution that I'm presently able to get working is,

call minpac#add('euclio/vim-markdown-composer', {'do': '!cargo build --release'})

Optionally I could not get the below to work

function! s:hook(hooktype, name)
  echom a:hooktype
  echom 'Directory:' minpac#getplugininfo(a:name).dir
  call system('cargo build --release')
endfunction
call minpac#add('euclio/vim-markdown-composer', { 'do': function('s:hook')})

Ideally, in a perfect world, I'd like to call function to update the cargo build of this package, when either the vim package or the rust toolchain is updated which seems to be quite frequent.

The ol have my cake 🎂 and eat it, 🍰 at the same time.

@k-takata
Copy link
Owner

Sorry for the late response.

I could not get the below to work

How did you check it? Did you see any error messages?
Does :mes show any information?

@Parasrah
Copy link

I have been looking into how to do something similar, and am wondering how you managed to get the do post-update hook to execute in the plugin directory instead of the cwd? I've been using the jobstart api, does your use of ! cause the shell command to execute in the appropriate dir? Thanks in advance 😄

@k-takata
Copy link
Owner

Before executing the post-update hook, minpac will change the cwd to the plugin directory.

@Parasrah
Copy link

Thanks @k-takata for the quick response, I will have to troubleshoot to see what I've done wrong with my setup. I'm sure I made a mistake someplace

@b-
Copy link

b- commented Jul 30, 2019

I have the following in a file with a list of package installs:

call minpac#add('neoclide/coc.nvim', {'do': '!install.sh'})

I don't know what I'm doing wrong, but it's failing to run install.sh in the neoclide/coc.nvim folder. I've tried much more complicated variants of this, as ideally I need this to work on both Windows and *nix (which would require if has('Win32') to use install.cmd instead), but even the most simple one doesn't seem to work, unless I'm getting something wrong, which is very possible.

Any suggestions? I'm trying to create a deployable (via git) vim config, and the manual step of compiling https://github.com/neoclide/coc.nvim is the one missing link so far.

EDIT: I found my issue. It should have been:

call minpac#add('neoclide/coc.nvim', {'do': '!./install.sh'})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants