VimStateVim
Unofficial
Vim’s state for one editor: which mode it is in, the command being typed, and everything needed to repeat the last edit.
The optional fields are absent until the feature that owns them is first used — an editor that has never searched has no search state, and one that has never left visual mode has no last selection.
Import:
import type { VimStateVim } from '@obsidian-typings/obsidian-catalyst-latest';Signature:
export interface VimStateVimProperties
| Property | Type | Description | |
|---|---|---|---|
| exMode? | boolean | Whether the Ex prompt is open. | |
| expectLiteralNext | boolean | Whether the next key is taken literally, which is how f and r read their argument through a langmap. | |
| inputState | VimInputState | The command currently being typed. | |
| insertEnd? | Bookmark | Where the current insertion ends, tracked so the inserted text can be found again after the document changes. | |
| insertMode | boolean | Whether the editor is in insert mode. | |
| insertModeRepeat? | number | How many times the insertion is repeated when insert mode is left, as 3i asks for. Only set while insert mode is active. | |
| insertModeReturn | boolean | Whether leaving insert mode returns to the mode it was entered from rather than to normal mode. | |
| lastEditActionCommand? | VimActionKeyMapping | The action command behind the last edit, replayed by .. | |
| lastEditInputState? | VimInputState | The input state that produced the last edit, replayed by .. | |
| lastHPos | number | The column the cursor should return to when moving between lines shorter than it. | |
| lastHSPos | number | The screen column the cursor should return to, which is what gj and gk move by. | |
| lastMotion | null | VimMotionFn | The motion that ran last, cleared as soon as a non-motion command runs. | |
| lastPastedText | null | string | The text pasted last, so a following paste can find what it replaced. | |
| lastSelection | null | VimLastSelection | The visual selection as it was when visual mode was last left, restored by gv. | |
| marks | Record<string, Bookmark> | The marks set in this editor, keyed by their one-character name. | |
| options | Record<string, VimOption> | The options set for this editor only, which override the global ones. | |
| searchState_? | VimSearchState | The search state for this editor. Absent until the first search. | |
| sel | VimSelection | The selection Vim is maintaining, which is empty until the first motion runs. | |
| status? | string | The key sequence shown in the status area while a command is being typed. | |
| visualBlock | boolean | Whether the editor is in visual block mode. No effect unless visualMode is set. | |
| visualLine | boolean | Whether the editor is in visual line mode. No effect unless visualMode is set. | |
| visualMode | boolean | Whether the editor is in visual mode. | |
| wasInVisualBlock? | boolean | Whether the selection that visual mode was just left from was a block, which operators consult after the mode has already been left. |
Methods
| Method | Returns | Description | |
|---|---|---|---|
| onPasteFn() | void | The paste handler installed on the editor's input field while Vim mode is on. |
Links to this page: