Skip to content

VimApi.mapCommand method

VimApi › mapCommand

Unofficial

Map a key sequence directly to a registered command, which is what map is built on.

Signature:

mapCommand(keys: string, type: "action" | "ex" | "idle" | "keyToEx" | "keyToKey" | "motion" | "operator" | "operatorMotion" | "search", name: string, args?: VimKeyMappingArgs | undefined, extra?: Partial<VimKeyMappingBase> | undefined): void

Parameters:

ParameterTypeDescription
keysstringThe key sequence to map.
type"action" | "ex" | "idle" | "keyToEx" | "keyToKey" | "motion" | "operator" | "operatorMotion" | "search"Which kind of command the keys run.
namestringThe name the command was registered under.
args?VimKeyMappingArgs | undefinedThe arguments passed through to the command when the key sequence invokes it.
extra?Partial<VimKeyMappingBase> | undefinedFurther fields to set on the mapping. context restricts it to one mode, and isEdit — which applies to actions only — decides whether the command is recorded for replay by the . single-repeat command.

Returns: void