lewis6991 / impatient.nvim

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

how to delete a specify module and reload #3

Closed windwp closed 3 years ago

windwp commented 3 years ago

thank for your plugin my startuptime reduce from 99ms to 66ms :+1:

https://github.com/nvim-lua/plenary.nvim/blob/master/lua/plenary/reload.lua i usually use that function to reload 1 module without reopen neovim. but it is not working with your plugin.

i try to do that but it is not working.

_G.__luacache.cache[packname] = nil

so can you provide a method to delete a cache module then reload it again.

lewis6991 commented 3 years ago

Sorry, are you saying _G.__luacache.cache[packname] = nil doesn't work? And when you say it doesn't work, how exactly? Can you be a little more specific?

windwp commented 3 years ago

in normal case when i call that reload function it will delete the cache in package.loaded then when i require again i will get a new code but when i using your plugin i still get the old code. i try to delete it in __luacache.cache but after i require again i get the error

lewis6991 commented 3 years ago

What error?

lewis6991 commented 3 years ago

It will be much easier if you can provide some reproducible steps with exact commands and steps.

windwp commented 3 years ago

I just update and check again with a latest commit and the issue is fixed now I can reload a module without an error

pocco81 commented 3 years ago

Hey @windwp, what did you use for getting your startup time? Just --startuptime? Or was it a plugin?

windwp commented 3 years ago

nvim --startuptime /tmp/vim.log -c "quit" && nvim /tmp/vim.log

just startuptime

tjdevries commented 3 years ago

For people reading this later, I added this automatically in plenary: https://github.com/nvim-lua/plenary.nvim/commit/e4e631f1056ef1dc4ce0f8ea944e2be42758a286 (Not sure if it's wise to do so, but I did it anyway)