Skip to content

VimApi.setOption method

VimApi › setOption

Unofficial

Write a Vim option.

Signature:

setOption(name: string, value: VimOptionValue, cm?: CodeMirrorEditor | undefined, cfg?: VimOptionConfig | undefined): Error | undefined

Parameters:

ParameterTypeDescription
namestringThe option's name.
valueVimOptionValueThe value to set. An option declared as a boolean takes true when this is omitted, and anything other than true or false is rejected.
cm?CodeMirrorEditor | undefinedThe editor to write the value to.
cfg?VimOptionConfig | undefinedWhich copy of the option to write.

Returns: Error | undefinedAn Error when no option of that name is registered or the value does not suit its type, otherwise nothing.

Remarks:

When cfg.scope is unset and an editor is given, **both** the global value and that editor's own value are set. When cfg.scope is given, only that copy is written.