That's a nice piece of Vimscript. Probably overkill for this situation,
at least if only run at startup before there are likely to be any local
variables, but it's still pretty cool.

Now if we just had a way to do script vars....

Without ability to purge script variables this code should not be used
after plugins are sourced: for example, you will render all my plugins
useless because they use script variables as guards

Mmm. I suspect a lot of plugins do this, and I think it's actually poor
Vimscript.

(and also check for particular global variables to provide a way for
user to disable them,

Scripts should only do this, following the example of things like
matchit and other bundled plugins, and indeed many of Vim's features
through its runtime files; they should set a global, e.g.
loaded_matchit, and not load if that is set. That allows the plugin to
be disabled by setting that global ahead of time, but also allows for it
to be enabled later by unsetting the global and sourcing the plugin (and
if it is really well written, it should also provide a way to turn
itself off by means of a command, and/or be able to be loaded gracefully
more than once).

Ben.



--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to