vim-maktaba icon indicating copy to clipboard operation
vim-maktaba copied to clipboard

Need to ensure initial settings are applied before sourcing instant/*.vim

Open dbarnett opened this issue 11 years ago • 4 comments

Plugin management code needs to do the following operations in order:

  1. Check if plugin FOO is installed on runtimepath
  2. If not: Fetch plugin, add to rtp
  3. Source instant/flags.vim
  4. Apply initial settings (e.g., !instant[somefile])
  5. 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.

dbarnett avatar Feb 22 '14 08:02 dbarnett

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.

dbarnett avatar Feb 22 '14 08:02 dbarnett

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.

dbarnett avatar Feb 22 '14 09:02 dbarnett

I'm guessing the proposal in #243 would make this obsolete?

malcolmr avatar May 22 '21 10:05 malcolmr

Yeah, looks like it!

dbarnett avatar May 23 '21 04:05 dbarnett