lewis6991 / pckr.nvim

Spiritual successor of https://github.com/wbthomason/packer.nvim
MIT License
243 stars 13 forks source link

feat: simply re-issue the event for event cond load plugins #29

Closed epheien closed 1 month ago

epheien commented 1 month ago

I referred to lazy.nvim's event based lazy loading implementation (https://github.com/folke/lazy.nvim/blob/main/lua/lazy/core/handler/event.lua#L161) and implemented event re-issue in pckr.

Without this feature, many plugins based on event loading will encounter problems (eg. InsertEnter).

For example:

      {
        --'hrsh7th/nvim-cmp',
        'epheien/nvim-cmp',
        requires = {
          'hrsh7th/cmp-nvim-lsp',
          'onsails/lspkind.nvim',
          'hrsh7th/cmp-buffer',
          'hrsh7th/cmp-path',
          'epheien/cmp-cmdline',
          'L3MON4D3/LuaSnip',
          'saadparwaiz1/cmp_luasnip',
          'rafamadriz/friendly-snippets',
        },
        cond = {event({'InsertEnter'}), keys('n', ';', ':'), keys('n', '/'), keys('n', '?'), cmd('CmpDisable')},
        config = function()
          require('config/nvim-cmp')
        end,
      };