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.72k stars 263 forks source link

feat: support for custom loaders via `cond` #1162

Closed lewis6991 closed 1 year ago

lewis6991 commented 1 year ago

@wbthomason

lewis6991 commented 1 year ago

We could take this further and make cond the only way to lazy load and just provide the existing handlers as utility functions:


local loader = require'packer.loader'

packer.add{
  {'my/plugin',
    cond = {
      loader.keys('n', 'ga'),
      loader.cmd('mycmd'),
      loader.event('CursorHold'),
      function(load_plugin)
        ... -- my custom loader
      end,
    },
  },
}
wbthomason commented 1 year ago

Didn't get a chance to post my review before merge (which is fine), but: