You are on page 1of 2

10/25/2019 How to view variables in Vim – Code Yarns

Code Yarns

Notes from the world of software

☰ Menu

How to view variables in Vim

Ashwin Uncategorized 2010-11-262015-11-01 1 Minute


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

:let

Note that this does not list environment variables, this post (2012/06/26/how-to-view-environment-variables-in-
vim/) shows how to view those.

If you find it hard to wade through the long list, you can redirect the output of this command
(http://stackoverflow.com/questions/2573021) to a buffer for further analysis. For example, to load the output of
:let into a buffer:

1 :redir @a
2 :let
3 :redir END
4 "ap

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

1 g:  global variables


2 b:  local buffer variables
3 w:  local window variables
4 t:  local tab page variables
5 s:  script-local variables
6 l:  local function variables
7 v:  Vim variables.

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

1 :let g:

Tried with: Vim 7.3 and Ubuntu 12.04 LTS

Tagged:
variable,
vim

Published by Ashwin
https://codeyarns.com/2010/11/26/how-to-view-variables-in-vim/ 1/2
10/25/2019 How to view variables in Vim – Code Yarns

View all posts by Ashwin

One thought on “How to view variables in Vim”

Pingback: How to view full path in statusline of Vim | chooru_code

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

Create a free website or blog at WordPress.com.

https://codeyarns.com/2010/11/26/how-to-view-variables-in-vim/ 2/2

You might also like