tani / vim-jetpack

The lightning-fast plugin manager, alternative to vim-plug
https://gist.asciidoctor.org/?github-tani/vim-jetpack/main//README.adoc&source-highlighter=highlightjs
MIT License
317 stars 31 forks source link

Execution timing of `config` differs from packer when `event` is set. #91

Closed gw31415 closed 1 year ago

gw31415 commented 1 year ago

This init.lua doesn't works properly, while equivalent init.lua works properly in packer.nvim.

vim.cmd 'packadd vim-jetpack'
require 'jetpack.packer'.startup(function(use)
    use { 'tani/vim-jetpack', opt = 1 }
    use { 'hrsh7th/cmp-cmdline', event = { 'CmdlineEnter' } }
    use {
        'hrsh7th/nvim-cmp',
        event = { 'CmdlineEnter' },
        config = function()
            local cmp = require 'cmp'
            cmp.setup.cmdline(':', {
                mapping = cmp.mapping.preset.cmdline(),
                sources = cmp.config.sources {
                    { name = 'cmdline' },
                }
            })
        end
    }
end)

Probably because, in the case of packer.nvim, all plug-ins are installed before all configs are run.

Do you plan to modify it to have the same behavior as packer.nvim?

gw31415 commented 1 year ago

I created simple docker containers to check this behavior. containers.tar.gz

containers
├── jetpack
│   ├── Dockerfile
│   └── init.lua
└── packer
    ├── Dockerfile
    └── init.lua
tani commented 1 year ago

Thank you for reporting the issue. I have confirmed the issue. Please check solution #92. Cheers,

tani commented 1 year ago

I have merged the changes. Please close this issue if you have no problem. Thanks.

gw31415 commented 1 year ago

Thanks. I have confirmed that the error that appears on first startup is resolved.

However, I noticed that even after revision, cmp-cmdline is not working even after CmdlineEnter. It does not seem to be due to the order in which the plugins are loaded (confirmed by print debugging).

Here is vim-jetpack case:

image

Here is packer.nvim:case:

image

In the case of vim-jetpack, nvim-cmp is not shown. These tests is conducted in the containers mentioned in this comment.

I created simple docker containers to check this behavior. containers.tar.gz

containers
├── jetpack
│   ├── Dockerfile
│   └── init.lua
└── packer
    ├── Dockerfile
    └── init.lua

The first problem is solved, so I'm going to close this issue. Thank you very much.