I've written some Vimscript code* in which it's convenient to have a set of shared color names. To use the names, so far I've had to rely on code like this:
execute 'source ' . expand('<sfile>:p:h:h') . '/plugin/colornames.vim'
This means that the scripts have to know something about where the names are defined. Although all of the code is strictly for my own use, I don't like introducing that kind of dependency.
Is there a general way to define Vimscript constants for use by all the (other) plugins?
* colors/custom.vim
, status line plugin, tab line plugin.
:h internal-variables
. And more precisely I think you want to create a global variable solet g:myGlobalVariable = "foo"
is probably what you need