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?: string[] | null | undefined, callback?: VimBooleanOptionCallback | undefined): 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?string[] | null | undefinedOther names the option answers to.
callback?VimBooleanOptionCallback | undefinedInvoked 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?: string[] | null | undefined, callback?: VimNumberOptionCallback | undefined): 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?string[] | null | undefinedOther names the option answers to.
callback?VimNumberOptionCallback | undefinedInvoked 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" | undefined, aliases?: string[] | null | undefined, callback?: VimStringOptionCallback | undefined): 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" | undefinedThe kind of value the option holds. Defaults to string.
aliases?string[] | null | undefinedOther names the option answers to.
callback?VimStringOptionCallback | undefinedInvoked to read and write the option, for options not backed by a stored value.

Returns: void