lewis6991 / impatient.nvim

Improve startup time for Neovim
MIT License
1.19k stars 28 forks source link

Is it possible to use it with vim-plug? #76

Closed WhiteBlackGoose closed 1 year ago

WhiteBlackGoose commented 1 year ago

Hello!

First of all, thanks for your outstanding work. I've been using multiple of your projects for some time already and they're amazing!

So, back to the topic. I have a trouble with some slow plugins which make my startup time around 700ms (me being on 11 years old HDD doesn't help XD). It's not a big deal, but it'd be nice to reduce it mb to 300. So I decided to try out this plugin.

Thing is, if I invoke setup it right after the end of vim-plug:

vim.call('plug#end')
require('impatient')

it won't affect my startup time. But if I do it before, it will fail to find this module.

Any way I can fix that?

(and btw, I don't have a huge preference for vim-plug, so I probably don't mind moving to something newer, it just will take some time to migrate for my 40-50 plugins setup to ensure no errors and all, you know. so if impatient isn't working on vim-plug, I'll perhaps migrate)

lewis6991 commented 1 year ago

Can you link to your config and I can make some suggestions?

WhiteBlackGoose commented 1 year ago

Sure! here here is how I load the plugins

(vim.g.use_ide() thing there is to load only on "ide" mode activated. That's the one I'd like to boost)

lewis6991 commented 1 year ago

Firstly, impatient only boosts the performance of loading lua files/modules. If a plugin contains no lua code, then it won't benefit at all.

Secondly vim-plug doesn't really provide anything we can use to load impatient earlier so we will need to load it manually.

Vim-plug installs all its plugins to vim.fn.stdpath('data') .. '/plugged' so we need to do something like:


vim.o.rtp = vim.fn.stdpath('data') .. '/plugged/impatient.nvim' ..','.. vim.o.rtp

require'impatient'

You'll probably want to wrap this in pcall in case impatient isn't installed.

WhiteBlackGoose commented 1 year ago

Added the first line of your snippet to the very beginning of init.lua and kept require'impatient' where it was, didn't help the startup time.

Although looking at :LuaCacheLog, looks like it loaded a lot of caches (but not the one for python provider :sweat_smile: , which is what introduces some overhead)

lewis6991 commented 1 year ago

Loading the module of the python provider won't be causing the slowness, it'll be running the module, i.e. executing the Lua code.

I'd avoid using any rpc plugins if you can, they're a little bit antiquated in the age of fast Lua plugins that run in-process.

WhiteBlackGoose commented 1 year ago

Okay, thanks