wbthomason / packer.nvim

A use-package inspired plugin manager for Neovim. Uses native packages, supports Luarocks dependencies, written in Lua, allows for expressive config
MIT License
7.82k stars 266 forks source link

Add a option that runs a function before config and after setup #980

Closed altermo closed 1 year ago

altermo commented 2 years ago

Add a key that runs a function before config and after setup

The problem:

I have a plugin a with the file:

if exists('loaded_a') 
  finish
endif
let g:loaded_a=1
command AAA ls

And a plugin b with the file:

if not exists('loaded_a')
  echoerr "pleas install plugin a"
  finish
endif
AAA

Then it is with current options impossible to lazy load a.

A possible solution:

Add an option that runs before the plugin is loaded from lazyloading but not at setup, let's call it preconf. Then it would be possible do this by:


use{'a',setup='vim.g.loaded_a=1',preconf='vim.g.loaded_a=nil',cmd='AAA'}
use 'b'