Re: Reading variables of a buffer/window that is not in scope

9 views
Skip to first unread message

Jürgen Krämer

unread,
Oct 2, 2012, 4:34:43 AM10/2/12
to vim...@googlegroups.com

Hi,

Brandon Coleman wrote:
> I would like to read the contents of variables for buffers that are
> not in scope. How would I go about doing this? Is there an example
> of a way to loop through all of the buffers? is there a command
> lookupWinVar(1,testVar)?

I don't know if there is a function which gives you all existing buffers,
but you can loop through buffer numbers from 1 to bufnr('$') and check if
the buffer really exists with bufexists().

Buffer-local variables can be read with getbufvar().

Regards,
J�rgen

--
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)

Ben Fritz

unread,
Oct 2, 2012, 10:59:20 AM10/2/12
to vim...@googlegroups.com, jott...@googlemail.com
On Tuesday, October 2, 2012 3:34:58 AM UTC-5, Jürgen Krämer wrote:
>
> I don't know if there is a function which gives you all existing buffers,
>

The best I know of is tabpagebuflist()

> but you can loop through buffer numbers from 1 to bufnr('$') and check if
>
> the buffer really exists with bufexists().
>
>
>
> Buffer-local variables can be read with getbufvar().
>
>

See also getwinvar(), gettabvar(), gettabwinvar(), and the "set" function for all of these.
Reply all
Reply to author
Forward
0 new messages