How to view variables in Vim

To view the list of all variables and their values in Vim:


Note that this does not list environment variables, this post shows how to view those.

If you find it hard to wade through the long list, you can redirect the output of this command to a buffer for further analysis. For example, to load the output of :let into a buffer:

:redir @a
:redir END

There are many types of variables in Vim and each has a special name or prefix:

g:	global variables
b:	local buffer variables
w:	local window variables
t:	local tab page variables
s:	script-local variables
l:	local function variables
v:	Vim variables.

To list the variables of a particular type, for example global variables, just use its prefix:

:let g:

Tried with: Vim 7.3 and Ubuntu 12.04 LTS

One thought on “How to view variables in Vim

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.