Keybindings
The Pi-TUI keybinding system provides configurable keyboard shortcuts for editor actions with support for multi-key bindings.Editor Actions
Editor actions that can be bound to keys:KeyId Type
Key identifiers support modifiers and special keys:Supported Modifiers
ctrl+- Control keyalt+- Alt/Option keyshift+- Shift key- Combine multiple:
ctrl+alt+x,shift+ctrl+z
Special Keys
enter,escape,tab,backspace,deleteup,down,left,righthome,end,pageUp,pageDownf1throughf12
EditorKeybindingsManager
Manages keybindings for editor actions.Constructor
Creates a new keybindings manager with optional configuration.EditorKeybindingsConfig
Optional keybinding overrides. Unspecified actions use defaults.
Methods
matches()
Checks if input data matches a specific action.string
required
Raw input data from terminal
EditorAction
required
Action to check against
getKeys()
Gets all keys bound to an action.EditorAction
required
Action to query
setConfig()
Updates keybinding configuration.EditorKeybindingsConfig
required
New configuration. Merges with defaults.
Configuration
EditorKeybindingsConfig
Configuration object mapping actions to key identifiers.- Single key:
{ submit: 'enter' } - Multiple keys:
{ submit: ['enter', 'ctrl+s'] }
Default Keybindings
Global Instance
Convenience functions for a global keybindings instance:Example
Key Matching
Low-level key matching functions:matchesKey()
Checks if raw input data matches a key identifier.string
required
Raw input data from terminal
KeyId
required
Key identifier to match
isKeyRelease()
Checks if input data is a key release event (Kitty protocol).string
required
Raw input data from terminal