You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Some plugins require a little bit of extra setup. For example, coc.nvim needs support for specific languages to be installed via :CocInstall and vimspector needs similar config. These are commands that install yet more things but they're installed by the plugin itself so you want to run them only once, after the plugin is installed for the first time. The build config is kind of the right thing except that it runs before the plugin is available so commands like :CocInstall or :VimspectorInstall aren't available yet.
Describe the solution you'd like
I can solve this by doing something like writing a "done" file somewhere as a marker that the post-install has run, then checking for that file in the config function, etc. but it's a bit of work. It'd be really nice if there was a post-install function you can specify in your config that's just like build but it runs after build and after the plugin has loaded.
Describe alternatives you've considered
Writing some kind of marker file whose existence I check in the config function.
Additional context
No response
The text was updated successfully, but these errors were encountered:
For what it's worth, I was able to build some that works, it'd just be nicer if it was part of lazy. Specifically I put this in lua/utils.lua:
local mod = {}
function mod.run_once(name, fn)
local post_install_file = vim.fn.stdpath("data") .. "/post_installs/" .. name
if vim.fn.filereadable(post_install_file) == 1 then
return
end
fn()
-- Create directory if it doesn't exist
vim.fn.mkdir(vim.fn.fnamemodify(post_install_file, ":h"), "p")
-- Create empty file
local file = io.open(post_install_file, "w")
file:close()
end
return mod
And then for things like coc.nvim I can have a lazy setup like this:
Did you check the docs?
Is your feature request related to a problem? Please describe.
Some plugins require a little bit of extra setup. For example,
coc.nvim
needs support for specific languages to be installed via:CocInstall
andvimspector
needs similar config. These are commands that install yet more things but they're installed by the plugin itself so you want to run them only once, after the plugin is installed for the first time. Thebuild
config is kind of the right thing except that it runs before the plugin is available so commands like:CocInstall
or:VimspectorInstall
aren't available yet.Describe the solution you'd like
I can solve this by doing something like writing a "done" file somewhere as a marker that the post-install has run, then checking for that file in the
config
function, etc. but it's a bit of work. It'd be really nice if there was apost-install
function you can specify in your config that's just likebuild
but it runs afterbuild
and after the plugin has loaded.Describe alternatives you've considered
Writing some kind of marker file whose existence I check in the config function.
Additional context
No response
The text was updated successfully, but these errors were encountered: