Skip to content

VimApi

Unofficial

Public API for interacting with the Vim emulation layer.

Import:

import type { VimApi } from '@obsidian-typings/obsidian-catalyst-latest';

Signature:

export interface VimApi

Properties

Property Type Description
suppressErrorLogging boolean Whether to suppress error logging from the Vim layer.

Methods

Method Returns Description
_mapCommand(command) void Register an internal key mapping command.
buildKeyMap() void Build the key map from the current configuration.
defineAction(name, fn) void Define a new Vim action with the given name and handler function.
defineEx(name, prefix, func) void Define a new Ex command with the given name and prefix.
defineMotion(name, fn) void Define a new Vim motion with the given name and handler.
defineOperator(name, fn) void Define a new Vim operator with the given name and handler.
defineOption(name, defaultValue, type, aliases?, callback?) void Define a new Vim option with default value, type, aliases, and change callback.
defineRegister(name, register) void Define a new named register.
enterInsertMode(cm) void Enter insert mode in the given editor.
enterVimMode(cm) void Enter Vim mode in the given editor.
exitInsertMode(cm, keepCursor?) void Exit insert mode, optionally keeping the cursor position.
exitVisualMode(cm, moveHead?) void Exit visual mode, optionally moving the head of the selection.
findKey(cm, key, origin?) boolean Look up a key binding in the given editor and origin context.
getOption(name, cm?, cfg?) unknown Get the value of a Vim option.
getRegisterController() object Get the register controller managing all registers.
getVimGlobalState_() object Get the global Vim state object.
handleEx(cm, input) void Handle an Ex command input string.
handleKey(cm, key, origin?) boolean Handle a key press in the given editor with the specified origin.
InsertModeKey(keyName) void Create an insert mode key binding for the given key name.
leaveVimMode(cm) void Leave Vim mode in the given editor.
map(lhs, rhs, ctx?) void Create a recursive key mapping from lhs to rhs in the given context.
mapclear(ctx?) void Clear all key mappings in the given context.
mapCommand(keys, type, name, args?, extra?) void Map a key sequence to a command type, name, args, and extra options.
maybeInitVimState_(cm) VimState Initialize the Vim state for the given editor if not already initialized.
multiSelectHandleKey(cm, key, origin?) boolean Handle a key press in multi-select mode.
noremap(lhs, rhs, ctx?) void Create a non-recursive key mapping from lhs to rhs in the given context.
resetVimGlobalState_() void Reset the global Vim state to defaults.
setOption(name, value, cm?, cfg?) void Set the value of a Vim option.
unmap(lhs, ctx?) void Remove a key mapping for lhs in the given context.

Links to this page: