kristijanhusak / vim-packager

Vim plugin manager that utilizes "jobs" and "pack" features.
MIT License
245 stars 9 forks source link

Switching from minpac, slow startup #10

Closed ahmedelgabri closed 4 years ago

ahmedelgabri commented 4 years ago

This might not be a plugin issue, maybe it's more how my config is set up. But I hope I can find some pointers on how to fix this.

This is my current setup with minpac & plugins#init() is called in init.vim

This is the new setup with vim-packager as you can see nothing much changed, it's a drop-in replacement for minpac.

I'm facing an issue with this line which runs every time I open neovim. With minpac there is nearly no overhead & things are instantaneous but with vim-packager this takes a couple of seconds.

minpac minpac

vim-packager vim-packager

kristijanhusak commented 4 years ago

Yeah i noticed the same thing. Had plans to optimize it, just didn't grab enough time.

Solution to this is to not call init every time. Is there any specific reason you do that? Having it loaded only when needed should do the trick, and it won't slow anything down.

ahmedelgabri commented 4 years ago

Yeah i noticed the same thing. Had plans to optimize it, just didn't grab enough time.

Great, thanks. I'll wait for this then.

Solution to this is to not call init every time. Is there any specific reason you do that? Having it loaded only when needed should do the trick, and it won't slow anything down.

plugins#init() is an autoloaded function so if I don't call it, then commands won't work properly because no plugin will be loaded including vim-packager or minpac. Or am I missing something here?

kristijanhusak commented 4 years ago

Plugins are automatically loaded, at least those that are not in the opt folder. That's the main feature of minpac/vim-packager. Vim/NeoVim does the loading, no need to do it manually like in vim-plug.

Check the example vimrc content here in readme https://github.com/kristijanhusak/vim-packager#vimrc-content

With those commands in the example, function loads up vim-packager and all the plugins for installation/update/clean.

This means that only when running install/update/clean things will take a second or two, but that's not really that bad.

ahmedelgabri commented 4 years ago

Plugins are automatically loaded, at least those that are not in the opt folder. That's the main feature of minpac/vim-packager. Vim/NeoVim does the loading, no need to do it manually like in vim-plug.

You are right, I dunno why I did this in the first place… will clean this up & see.

ahmedelgabri commented 4 years ago

Fixing plugins#init()& the commands fixed the issue.

FYI, PackagerClean or PackagerStatus are slower than minpac too. Not a big deal at all, but worth mentioning.

Thank you

kristijanhusak commented 4 years ago

@ahmedelgabri I optimized it a bit. Do an update and check. Should be faster now. I still don't suggest calling plugins#init() on vim startup, because there's no really a need for it.

ahmedelgabri commented 4 years ago

@ahmedelgabri I optimized it a bit. Do an update and check. Should be faster now.

Slightly better yeah, thanks!

I still don't suggest calling plugins#init() on vim startup, because there's no really a need for it.

The idea behind plugins#init() was to auto install packages when I initially setup a new machine (I know that I can do nvim +PackInstall, but I'm lazy & I know that I will forget doing this on a new machine), the implementation though was bad. So I will need to revisit that. Right now I changed the logic to exit early so it's just a simple check.