Should values that a Vim plugin allows users to set be defined as options or variables? I'm not quite sure what the difference is, or what the impact of using one over the other is.
If by "options" you mean things like autoindent
or colorcolumn
, you can set
or unset
them and retrieve their value… but you can't create "options".
What you can use, though, are "internal variables" on which you can read all about in :help internal-variables
.
Use global variables (g:var
) for the user-defined "options" of your plugin and script-local variables (s:var
) or function-local variables (l:var
or simply var
inside a function) in your script.
if !exists('g:myplugin_option')
let g:myplugin_option = 1
endif