Hi,

All global variables can be found through g: which is a hash table
itself.  It might be good to hide those variable from outside and
limit its use only to the plugin itself.

I found a way to do it:

" ------------------------------------------------
let G = []
call add(G, "g:vimim_datafile")
call add(G, "g:vimim_signature")
" ...
" ------------------------------------------------
for variable in G
    let s_variable = substitute(variable,"g:","s:",'')
    if !exists(variable)
        exe 'let '. s_variable . '=0'
    else
        exe 'let '. s_variable .'='. variable
        exe 'unlet! ' . variable
    endif
endfor
" ------------------------------------------------

This enables

(1) global variables can be defined in vimrc as usual
(2) no global variables can be accessed outside the plugin


Sean

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to