Skip to content

VimApi.defineOption method

VimApi › defineOption

Unofficial

Register an option that :set can read and write.

Signature:

defineOption(name: string, defaultValue: boolean | null | undefined, type: "boolean", aliases?: null | string[], callback?: VimBooleanOptionCallback): void

Parameters:

ParameterTypeDescription
namestringThe option's name.
defaultValueboolean | null | undefinedThe value the option takes until it is set. Required unless a callback is given.
type"boolean"The kind of value the option holds.
aliases?null | string[]Other names the option answers to.
callback?VimBooleanOptionCallbackInvoked to read and write the option, for options not backed by a stored value.

Returns: void


Unofficial

Register an option that :set can read and write.

Signature:

defineOption(name: string, defaultValue: number | null | undefined, type: "number", aliases?: null | string[], callback?: VimNumberOptionCallback): void

Parameters:

ParameterTypeDescription
namestringThe option's name.
defaultValuenumber | null | undefinedThe value the option takes until it is set. Required unless a callback is given.
type"number"The kind of value the option holds.
aliases?null | string[]Other names the option answers to.
callback?VimNumberOptionCallbackInvoked to read and write the option, for options not backed by a stored value.

Returns: void


Unofficial

Register an option that :set can read and write.

Signature:

defineOption(name: string, defaultValue: string | null | undefined, type?: 'string', aliases?: null | string[], callback?: VimStringOptionCallback): void

Parameters:

ParameterTypeDescription
namestringThe option's name.
defaultValuestring | null | undefinedThe value the option takes until it is set. Required unless a callback is given.
type?'string'The kind of value the option holds. Defaults to string.
aliases?null | string[]Other names the option answers to.
callback?VimStringOptionCallbackInvoked to read and write the option, for options not backed by a stored value.

Returns: void