Skip to content
Discussion options

You must be logged in to vote

Got it, you want it on demand, not loaded at startup. Then there's no event to hook, unfortunately. :packadd mini.test only adds the directory to runtimepath, and since the plugin has no plugin/ file nothing is sourced, so SourcePost never fires for it. I also checked SourcePre and OptionSet on runtimepath: neither fires on :packadd either.

What works is doing the :packadd yourself through a small command, so you still decide when it loads and the setup runs right after:

local setups = {
  ["mini.test"] = function() require("mini.test").setup() end,
}

vim.api.nvim_create_user_command("Packadd", function(opts)
  vim.cmd.packadd(opts.args)
  local setup = setups[opts.args]
  if setup then s…

Replies: 3 comments 9 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
5 replies
@wmorin
Comment options

Answer selected by ymic9963
@ymic9963
Comment options

@echasnovski
Comment options

@ymic9963
Comment options

@echasnovski
Comment options

Comment options

You must be logged in to vote
4 replies
@ymic9963
Comment options

@echasnovski
Comment options

@ymic9963
Comment options

@echasnovski
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested mini.test
3 participants