On Sun, Feb 8, 2009 at 9:13 PM, Matt Wozniski <[email protected]> wrote:

>
> On Sun, Feb 8, 2009 at 11:40 PM, Garrett Whelan <[email protected]>
> wrote:
> > I would like to be able to access all the variables at a given time in
> Vim
> > without necessarily knowing what they are.  Basically everything you
> would
> > see if you typed :let and :set.  So in increasing order of difficulty
>
> There's no easy way to get all options, afaik.  All variables, though,
> isn't too tough: you can treat the scopes as a dictionary keyed by
> names of values in that scope.  So, for example:
>
> for [var, val] in items(g:)
>  echo "Global variable \"" . var . "\" is \"" . val "\""
>  " The type might change, so we unlet it before it's assigned again
>  unlet val
> endfor
>
> > Is there a way to redirect the output from :let and :set? It would be
> pretty
> > simple to parse that up, but I can't figure it out.
>
> Yes.  :help :redir - but, again, probably not what you want to do.
>

Perfect. Either of those should be able to get me what I want(with a little
massaging). And I had no idea that each scope was just a dictionary, genius.


>
> > Is there a way to call functions in the Vim code from VimL?  Browsing
> > through the source I see list_hashtable_vars seems to have the info I
> need.
> > Is there a way to access the actual C data structures from VimL? If I
> could
> > read the various hashtables myself I could do what I needed.
>
> No... those would be awfully strange features for a scripting language...
>

For a pure scripting language I'd agree, but this is a scripting language in
an environment. Allowing direct access to core functions/variables allows
huge flexibility *without having to recompile the code*.

When using UnrealScipt you can even extend classes from the Unreal Engine.

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

Raspunde prin e-mail lui