vim-maktaba
vim-maktaba copied to clipboard
Need to ensure initial settings are applied before sourcing instant/*.vim
Plugin management code needs to do the following operations in order:
- Check if plugin FOO is installed on runtimepath
- If not: Fetch plugin, add to rtp
- Source instant/flags.vim
- Apply initial settings (e.g.,
!instant[somefile]
) - Source other instant files
We currently have a problem that checking whether plugin FOO is installed on runtimepath (using maktaba#plugin#IsRegistered
or similar) will automatically trigger step 5 before we've had a chance to get to step 4. This is bad because it makes it impossible to disable instant/ files before they're initially sourced.
We could make maktaba#plugin#Detect
and maktaba#plugin#Enter
be the only things that automatically trigger sourcing instant files, and have an explicit function to do the maktaba initialization (steps 3–5, including initial settings). This might require some special care with the other functions, though: if we want instant files guaranteed to be called before you get a plugin handle, we need to figure out what to do if Get is called before the explicit init. Glaive will also require some special care: it should be able to apply settings as initial settings if the plugin hasn't been initialized, and should know plugin FOO is configurable even if the plugin handle isn't available yet.
Also, GetOrInstall
is a partial workaround for these problems: It handles checking if the plugin already exists in a way that doesn't trigger instant files early. But the behavior is rarely exactly what you want. It forces you to have a plugin path before checking if the plugin is already installed and throws an error if it encounters a conflicting path. Plugin management code usually needs more flexibility.
Regardless, I'm concerned about doing anything to deprecate GetOrInstall
before this initial settings problem is solved.
I'm guessing the proposal in #243 would make this obsolete?
Yeah, looks like it!