Skip to content

VimApi.setOption method

VimApi › setOption

Unofficial

Write a Vim option.

Signature:

setOption(name: string, value: VimOptionValue, cm?: CodeMirrorEditor, cfg?: VimOptionConfig): 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?CodeMirrorEditorThe editor to write the value to.
cfg?VimOptionConfigWhich copy of the option to write.

Returns: Error | undefined — An 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.