On Nov 28, 3:51 am, Tom Link <[email protected]> wrote: > I slightly disagree with ZyX on that. IMHO global variables should be > used to allow users to configure your script. It is common practice > that users set that variables in their vimrc file and that the plugin > defines that variable only if it hasn't already be set by the user. > > in vimrc: > let g:org_foo = 1 > > in org.vim (or whatever the plugin file is called): > if !exists('g:org_foo') | let g:org_foo = 0 | endif > if !exists('g:org_bar') | let g:org_bar = 0 | endif > > If you maintain all user-configurable parameters in a single > dictionary, there is a chance you make it harder for users to > configure your scripts. Or you'd have to check for the existence of > single keys: > > in vimrc: > let g:org = {'foo': 1} > > in org.vim > if !exists('g:org') | let g:org = {} | endif > if !exists('g:org.foo') | let g:org.foo = 0 | endif > if !exists('g:org.bar') | let g:org.bar = 0 | endif > > So, there's an extra step involved and I'm not sure it get you > anything. >
I strongly agree. I've tried the dictionary approach in Vimuiex/VxLib, but it doesn't work to well. So if you have any settings that the user can configure, put them in global variables (eg. g:org_X). For the rest I would use either s: or global dictionaries (eg. g:org_private_X). Marko -- 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
