I can see in vim how we can:
But I want to:
- Call function only when the plugin is
required
Vi and Vim Stack Exchange is a question and answer site for people using the vi and Vim families of text editors. It only takes a minute to sign up.
Sign up to join this communityI can see in vim how we can:
But I want to:
required
This is pretty much standard sequence of steps.
opt
subtreepackadd
when requiredpackadd
executed for the first time.Initialization works the same way as with regular plugins
- with regular plugins I will have some code in my ./plugin
folder (not my ./pack/start/*
folder(s)... this ./plugin
code will run unequivocally on startup. However, if I only wanted to run that code when I packadd matchit
or something like that... then how do I do THAT. What is the mechanism of step 3? A plugin will have it's own ``./pack/opt/bundle/some_plugin/plugin/init.lua` folder to initialize itself. But I want to do additional work in my ./plugin/additional_config_for_some_plugin.lua
file
Jul 26 at 20:44
/start
but still needs too many setup function call(s) then you have to admit it's a dumb piece of code and you'd better to drop it.
k-takata/minpac
, for example.
functions that require the plugin code
instead of opt
to delay loading a plugin. My use case is that I'm using copilot.nvim
and I don't wanna load it until I manually load it. I'm sure I can trivially figure out what specific config delays loading of the plugin and also write a small command that lets me load it later. It's just stupid that I can't use the perfectly fine packadd
command to do this. Maybe I'll just make a command that runs setup and THEN calls packadd
. Exactly as u said
Jul 27 at 21:45
packadd
) is loaded. But I cannot find the Autocmd to run after apackadd
. Maybe there is an autocmd after arequire
was my next thought.require
is Lua semantics. You'd have to change its behavior somehow.