Giter Site home page Giter Site logo

Add post-install hooks about paq-nvim HOT 7 CLOSED

savq avatar savq commented on July 17, 2024 3
Add post-install hooks

from paq-nvim.

Comments (7)

savq avatar savq commented on July 17, 2024 3

This works now. Paq can install fzf like so:

paq{'junegunn/fzf', hook=vim.fn['fzf#install'] }

Closing notes:

  • Running :packloadall! will source newly installed packages correctly. It's not ideal, but it works.

  • Future work (including issue #2) may lead to a more organized two stage installation, a first batch of callbacks for installs, and a second for hooks and helptags; requiring only one :packloadall! in the middle.

from paq-nvim.

savq avatar savq commented on July 17, 2024 1

Hi. part of this feature is already in the dev branch, running shell commands to be specific. The second part, running user defined functions, is still pending what I'm doing this afternoon.

After that, I'd still need to run some tests, but I should be merging this weekend.

...way to defer a command until after a previous function is completed?

The tricky part is that we don't know when the install function ends. The hooks would run as callbacks to the install/update callbacks.

In the meantime, I can tell you that when paq prints out that it is installing something, it has in fact already done it. That's because I'm lazy Paq uses the same function to notify on success and failure.

from paq-nvim.

savq avatar savq commented on July 17, 2024 1

Quick update:

So far the hooks work, except for one small issue: the plugin isn't added to the runtime the first time it's installed, so the hook will fail the first time it runs, but it'll suceed if one re-enters nvim and runs :PaqUpdate.

This is super annoying of course, so for now I'm leaving this feature in it's own branch updatehooks.


Note: So far, I've only tried running packadd! and appending to vim.o.runtimepath, the latter wouldn't be ideal anyways because it requires checking whether it's installing or updating something.

from paq-nvim.

megalithic avatar megalithic commented on July 17, 2024 1

HUGE thank you @savq !!

from paq-nvim.

megalithic avatar megalithic commented on July 17, 2024

Is there a current best practice to doing this sort of thing; say after PaqInstall'ing fzf/fzf.vim to run the fzf installer scripts? maybe there's a lua way to defer a command until after a previous function is completed? i know this is something you're figuring out, just wondering if there is something to do in the interim.

from paq-nvim.

megalithic avatar megalithic commented on July 17, 2024

Huge thanks @savq !!

from paq-nvim.

kovasap avatar kovasap commented on July 17, 2024

Based on the README documentation, it isn't clear to me how to e.g. run a shell command after installing a plugin (from that plugin's directory). Is this possible using this feature? If so, could a short example for how to do it be added to the README?

from paq-nvim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.