Display value of :set option
Use the :set
command.
:set autoindent?
prints the option, and its value, if any. Vim toggle options (booleans, options that are on/off), likeautoindent
, are prefixed withno
to indicate that they're turned off, so:set autoindent?
will displayautoindent
ornoautoindent
.:set autoindent
turnsautoindent
on.- this form turns toggle options on
- for number or string options, this shows the value of the option, so
:set textwidth
will also print the value of the option. For number or string options,:set option
is equivalent to:set option?
.
:set autoindent!
inverts the option.autoindent
becomesnoautoindent
.:set autoindent&
revertsautoindent
to its default value.- Set number or string options with
:set option=value
, e.g.set tabstop=3
Use :set textwidth?
to show the value of textwidth
.
Use :verbose set textwidth?
to show where this value was last set.
In general, you can add ?
after the setting name to show its current value.