For convenience, I'd like to define some variables. But I worry that I may forget their names. How can I get a list of them?

2 Answers 2


If it's a global variable then it resides in g: dictionary, so simply echo g: works.

If g: is too big it's possible to search through it, like any other dictionary, for example:

echo copy(g:)->filter('v:key =~# "^loaded_"')

You can use command :let on its own to list the contents of all defined variables.

See :help E121:

:let: List the values of all variables.

If you have an idea of what the beginning of the name of the variable might be, you can also use tab completion. For example, for a variable starting with "open", you can use :let open<Tab> to start cycling over all of those, or :let open<C-A><CR> to list the contents of all of them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.