Vim Check Current Value of an Option Setting
We can ask Vim to show or display the current value of an option by appending a ?
with :set {option}
. The official syntax is :se[t] {option}?
.
" Get current value of a single option
:set number?
" Outputs something like:
" number (if number option is on)
" nonumber (if number option is off)
" Get current value of multiple options
:set expandtab? tabstop? wrap?
" Outputs:
" noexpandtab
" tabstop=8
" wrap
For the second version shown above, this is what the output will look like:

expandtab
is a boolean option which is off (noexpandtab
).tabstop
is an option that takes a value set to8
.wrap
is another boolean option which is on in this case.