google/vim-maktaba

Deprecate misc instant/*.vim files

dbarnett opened this issue · 2 comments

Should we get rid of maktaba's feature to detect and source vimscript files under a plugin's instant/ directory? It's one of the more "magical" features and contributes to slow startup times.

There's one special case of instant/flags.vim tracked separately in #189 that deserves some special attention. For other cases, if "instant" setup really can't be deferred until later in vim's init process, it could just go into an autoload helper function designed to be called explicitly in vimrc.

Looking around for existing instant/ files, I found a couple interesting cases besides flags.vim:

  • Pre-configuring default settings for vim that can be overridden later in vimrc. May need to go in autoload helpers if they can't use other tricks to avoid stomping on users' explicit config.
  • Registering hooks with other plugins. I suspect these actually don't need to be instant.
  • Attempts at automatic dependency management. These should probably just be dropped to no longer be automatic, but to give clear warnings if they're installed without essential dependencies.

And since this will require a plugin-by-plugin migration process, I'd want users to be able to easily report issues to plugin maintainers and have an escape hatch to re-enable the legacy behavior. The override could look something like this:

call maktaba#EnableLegacyInstantFilesForPlugins(['someplugin', 'codefmt', 'syncopate'])

taking a list of plugin names that still need legacy behavior and ignoring instant files for everything else. You could opt-in for ALL your plugins like:

call maktaba#EnableLegacyInstantFilesForPlugins([])

and at some point we'd update maktaba to make that the default behavior.