Input.KeymapSourceKey binding maps. See Keymap.
Key binding maps.
A keymap binds key and modifier combinations to values. Later bindings take precedence over earlier ones: add general bindings first, then more specific ones to override.
add leaves unspecified modifiers as wildcards (match any state), enabling prefix-free patterns like Ctrl+C without constraining Shift or Alt. add_char defaults all modifiers to false (exact match), so add_char 'c' only matches a plain c press with no modifiers active.
Note. Lock states (caps_lock, num_lock) are not matchable by keymaps since they represent toggle states rather than pressed modifiers.
The type for immutable keymaps binding keys to values of type 'a.
val add :
?ctrl:bool ->
?alt:bool ->
?shift:bool ->
?super:bool ->
?hyper:bool ->
?meta:bool ->
'a t ->
Input__.Event.Key.t ->
'a ->
'a tadd map key data is map with a binding from key to data. Unspecified modifier arguments are wildcards (match any state). Later bindings take precedence.
val find :
?event_type:(Input__.Event.Key.event_type -> bool) ->
'a t ->
Input__.Event.t ->
'a optionfind map event is the most recently added binding matching a Event.Key event with compatible modifiers, or None if event is not a key event or no binding matches.
event_type filters which key event types are eligible. It defaults to accepting Event.Key.Press and Event.Key.Repeat but rejecting Event.Key.Release, which prevents bindings from firing on key-up on terminals supporting the Kitty keyboard protocol. Pass ~event_type:(fun _ -> true) to match all event types.