Kit
Kit

Reputation: 31513

How do I inspect Vim variables?

In .vimrc, there are several lines that look like:

let g:SuperTabDefaultCompletionType="<c-x><c-o>"

How do I inspect them inside Vim? Something to this effect:

:echom &g:SuperTabDefaultCompletionType

But that command results in an error:

E113: Unknown option: SuperTabDefaultCompletionType
E15: Invalid expression: &g:SuperTabDefaultCompletionType

How do I inspect these kinds of variables in Vim? Some plugins set some defaults which I need to inspect.

Upvotes: 118

Views: 88747

Answers (3)

jlemos
jlemos

Reputation: 536

See if this helps: http://learnvimscriptthehardway.stevelosh.com/chapters/19.html. Should give you some insight on how vim variables work, and you can check out chapter 20 as well if you have any difficulties inspecting them due to scope issues.

Upvotes: 9

beta
beta

Reputation: 2550

Like lucapette wrote you can use :echo g:foo to inspect a variable. You can also use :let to see all defined variables and their values.

Upvotes: 31

lucapette
lucapette

Reputation: 20724

:echo g:SuperTabDefaultCompletionType

works fine. It gives an error if the variable isn't defined.

Upvotes: 125

Related Questions