FR: cleanup on startup
chrisgrieser opened this issue · 5 comments
Plugin managers like lazy.nvim
are also able to automatically uninstall unused plugins. This is particularly useful when working on multiple machines, and you want to keep your installed tools in sync as well.
Currently, ensure_installed
only ensures that a tool that is listed, but not installed, is being automatically installed. However, tools that are installed but not listed are not automatically uninstalled.
Anything that does this would need to be opt-in. I often install things using the :Mason
menu. Eventually I may add it to my list of things to automatically install, or I may delete it.
This seems like a reasonable request. I can see it as a user command or api call. This can be called by the user whenever the user wants it to run including startup.
The current main
has a new command: MasonToolsClean
. Try it out. Let me know if it works for you. Currently no documentation.
Thank you very much! I just gave it a try and so far everything seems to work.
Only thing I noticed was that as opposed to MasonToolsInstall
, there are apparently no notifications to inform you about the cleanup (yet).
It's using vim.notify
to print the messages.
yes, and I do use nvim-notify
.
But I figured it out, it was a race condition as :MasonToolsClean
seems to run before nvim-notify
is loaded. (And apparently, :MasonToolsInstall
is a tad slower, and therefore only triggered after nvim-notify
is loaded :S)
Deferring MasonToolsClean
a bit results in the notifications being shown.
So in that case, everything works as intended. Thank you!