function injectHotkeySequence(
sequence,
callback,
options): void;
Defined in: injectHotkeySequence.ts:58
Angular inject-based API for registering a keyboard shortcut sequence (Vim-style).
Allows you to register multi-key sequences like 'g g' or 'd d' that trigger when the full sequence is pressed within a timeout.
Each step may include modifiers. You can chain the same modifier across steps (e.g. Shift+R then Shift+T). Modifier-only keydown events (Shift, Control, Alt, or Meta pressed alone) are ignored while matching—they do not advance the sequence or reset progress.
Array of hotkey strings that form the sequence (or getter function)
HotkeySequence | () => HotkeySequence
HotkeyCallback
Function to call when the sequence is completed
Options for the sequence behavior (or getter function). enabled: false still registers the sequence (visible in devtools); only execution is suppressed.
InjectHotkeySequenceOptions | () => InjectHotkeySequenceOptions
void
@Component({ ... })
export class VimEditorComponent {
lastSequence = signal<string | null>(null)
constructor() {
injectHotkeySequence(['G', 'G'], () => this.lastSequence.set('gg → Go to top'))
injectHotkeySequence(['D', 'D'], () => this.lastSequence.set('dd → Delete line'))
injectHotkeySequence(['C', 'I', 'W'], () => this.lastSequence.set('ciw'), { timeout: 500 })
injectHotkeySequence(['Shift+R', 'Shift+T'], () => this.lastSequence.set('⇧R⇧T'))
}
}