Hotkey Sequence API Reference

createHotkeySequences

Function: createHotkeySequences()

ts
function createHotkeySequences(sequences, commonOptions): void;

Defined in: createHotkeySequences.ts:61

SolidJS primitive for registering multiple keyboard shortcut sequences at once (Vim-style).

Uses the singleton SequenceManager. Accepts a dynamic array of definitions, or accessors, so you can react to variable-length lists.

Options are merged in this order: HotkeysProvider defaults < commonOptions < per-definition options

Definitions with an empty sequence are skipped (no registration).

Parameters

sequences

Array of sequence definitions, or accessor returning them

CreateHotkeySequenceDefinition[] | () => CreateHotkeySequenceDefinition[]

commonOptions

Shared options for all sequences, or accessor

CreateHotkeySequenceOptions | () => CreateHotkeySequenceOptions

Returns

void

Examples

tsx
function VimPalette() {
  createHotkeySequences([
    { sequence: ['G', 'G'], callback: () => scrollToTop() },
    { sequence: ['D', 'D'], callback: () => deleteLine() },
  ])
}
tsx
function Dynamic(props) {
  createHotkeySequences(
    () => props.items.map((item) => ({
      sequence: item.chords,
      callback: item.action,
      options: { enabled: item.enabled },
    })),
    { preventDefault: true },
  )
}