3

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?

5

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_"')
2

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, privacy policy and cookie policy

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