RFC: Gatekeeper - control which plugins are loaded
mrvn at renich.org
Tue Apr 22 22:36:08 UTC 2008
* Meikel Brandmeyer <mb at kotka.de> [080421 17:46]:
> Hello Vim developers,
> some days ago, there was a short discussion on #vim, that one cannot
> easily prevent plugins from loading. A distribution could install some
> scripts/plugins in the system-wide vimfiles directory, but the user
> could not defend against such a "pollution". Each plugin uses a
> different guard, so it's tedious to find out which one keeps a script
> from loading.
> I thought a bit about this problem and came up with the following
> solution: Gatekeeper. Gatekeeper keeps track of which plugins the user
> wants to load, which plugins the users dislikes and which he doesn't
> care about. So it is easy to disable specific plugins.
> From the script's perspective using gatekeeper is quite simple. It is a
> single function call, which is used in the plugin guard header, which
> prevents the script from being sourced multiple times. In fact,
> gatekeeper even simplifies this header, since the normally used guard
> variable is hidden away.
> So I'd like to drop this on the list with a request for comments. Any
> comments on the idea are appreciated.
Actually, I like Debian's approach (thanks Debian Vim Maintainers and
especially Stefano Zacchiroli). Rather than force every plugin to use a
common interface to allow enabling/disabling individual plugins in a
distribution, they built a vim-addon-manager package that allows the
sysadmin to determine which plugins are enabled by default, and allows
individual users to enable/disable each plugin separately, overriding
the sysadmin's defaults.
The global defaults are done by placing the scripts in a directory that
is not in Vim's rtp, and then using symlinks to the system-wide enabled
ones in a directory that is in rtp. Individual user preferences are
likewise symlinks in the user's .vim/ directory structure. The only
tricky part is disabling a default-enabled system-wide script. This is
done by the Vim maintainers by manually determining for each script what
to put in ~/.vim/plugin/000-vim-addons.vim to tell the script not to
load (or make it think it is already loaded).
More kudos to the Debian Vim Maintainers:
Some people are really concerned about having the absolute latest
patches to Vim and compile Vim themselves to that end. The Debian
maintainers are very responsive, and while you cannot always get the
latest patches in a binary Debian package, you can usually get very
close. Currently, you can get official Debian packages with Vim
7.1-293, which is, indeed, the most up-to-date version.
More information about the pkg-vim-maintainers