Load plugins using denops.vim lazily
Denops is an ecosystem of Vim/Neovim which allows developers to write plugins in Deno.
This PR enables packer.nvim to load denops.vim plugins lazily. Such plugins can be used after the deno process has started and denops.vim has finished the initialization. packer.load can wait for them with this patch.
I have used the logic from dein.vim for reference to achieve this.
examples to use this
-- fuzzy-motion.vim needs denops.vim to be loaded before itself. I want to load
-- it lazily when 's' is pressed in the Normal mode.
{
{'vim-denops/denops.vim'},
{
'yuki-yano/fuzzy-motion.vim',
cmd = {'FuzzyMotion'},
setup = function()
vim.api.nvim_set_keymap('n', 's', '<Cmd>FuzzyMotion<CR>')
end,
},
}
-- You can load denops.vim lazily itself with `wants` option.
{
{'vim-denops/denops.vim', opt = true},
{
'yuki-yano/fuzzy-motion.vim',
cmd = {'FuzzyMotion'},
wants = {'denops.vim'},
setup = function()
vim.api.nvim_set_keymap('n', 's', '<Cmd>FuzzyMotion<CR>')
end,
},
}
FYI: plugins using denops.vim can be found here.
- https://github.com/topics/vim-denops
- https://github.com/topics/denops
Thanks, and sorry for taking so long to get to this. Is the idea that this will automatically load the Deno parts of any plugins which have them? I apologize for my confusion; I'm not familiar with denops/its uses.
@wbthomason Thank you for reviewing.
Usually, denops.vim automatically discovers other plugins using denops and load them.
https://github.com/vim-denops/denops.vim/blob/4e694e1ebd868e7448e7f6f82e844c88719f0756/plugin/denops.vim#L22-L22
But this func (denops#plugin#discover()) is called only once in loading denops.vim itself. So we should make denops.vim discover plugins we want to load lazily by calling denops#plugin#register() manually.