FYI - I implemented this for govim and it's working rather well: https://github.com/myitcv/govim/blob/5a5f92f0433c07b2aa48a81e7285590f06eb12e7/autoload/govim/config.vim
With the one exception of when govim is loaded as a Vim8 package, because (and this is a detail I only just came across) packages are loaded _after_ the .vimrc. A workaround for this is to do a packloadall at the end of the .vimrc, followed by calls to the config functions. Is there perhaps a cleaner solution? Thanks in advance. On Thu, 30 May 2019 at 18:06, Paul Jolly <[email protected]> wrote: > > Hi all, > > As a follow up to a recent thread ("Plugins exposing events to other > plugins": https://groups.google.com/d/msg/vim_dev/uiw6gHft-0g/i8qdfT8YBQAJ) > I'd like to ask whether there is an existing pattern of configuration > functions that plugin developers follow? > > Some background. > > I'm not really a fan of global config variables in .vimrc files, e.g.: > > let g:govim_quickfix_auto_diagnotics_disable=1 > > especially when it comes to channel-based plugins, because they (the > channel-based plugins) end up having to make a roundtrip call to check > a global variable value; if this is on a "hot" path it becomes > expensive. But also because it's too easy to mis-type/set an invalid > value. > > So I'd like to explore a pattern by which the end user calls a config > function from their .vimrc or whenever they want to change a config > value. This will have the benefit of pushing the config value to the > channel-based plugin, but also allowing tighter validation at the time > of the value being set. > > The main problem (aside from my complete lack of real understanding of > the .vimrc load sequence) is that plugins have not loaded at the time > .vimrc is processed, and hence it's not possible to call a > plugin-defined config function directly... so we'd need to handle this > somehow. > > Does anyone have any thoughts on/experience of the above? > > Thanks in advance, > > > Paul -- -- 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/CACoUkn5eSpRrYCR_TOBBqjs8vM5soeHY0SyFn-E3qNv0%2B3QkzA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
