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.

> 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...

> I suspect there's no way to do any of this, but I thought I'd ask before I
> took a more...cumbersome route. Oh, also what is this declaration structure:

K&R style C.  Vim's old.  Back when ANSI C was still not so popular.

~Matt

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

Raspunde prin e-mail lui