Thanks for the detailed response.

> I don't really see the difference between configuring via global
> variable or by calling a function in your vimrc.  Your plugin doesn't
> need to check vim's global variable every time you use a feature, just
> check it once during plugin initialization and set some internal
> variable (supposing your plugin is written in go/python/etc).  There is
> no expectation to the user that modifying `g:govim_whatever` will take
> immediate effect after the plugin has already started (if you want you
> can provide a :GovimReload or similar).  You can also do validation just
> once when you are saving the values.

Understood, thanks.

The point about the user's expectation on changing the config value at
runtime is key; I'd like to provide an approach that will work either
in vimrc (i.e. pre-init) or at runtime (i.e. post init).

> Another option is to use a separate .json or .ini file for configuration
> so you don't have to worry about vimrc/plugin sourcing order.  But this
> is less idiomatic than putting settings in a single g: dictionary.

Agreed, I'd like to avoid this.

> To address the direct question, a standard is to use autoloaded
> functions, `call myplugin#configure()`.  This merely requires the plugin
> to be in the runtimepath which is handled by :Plug or packadd!   A
> seperate standard is to use User autocmd which requests the user call
> some myplugin#configure() function- if the autocmd is fired the plugin
> is definitely loaded and ready to get options set.

autoload appears to be exactly what I'm after, thank you. I'll give
this approach a try.

Thanks again.

-- 
-- 
You received this message from the "vim_dev" 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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/CACoUkn5qJJ2WjAy41_8bhmW02edEzAiytHX0QAzZXQX8k40vqA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui