gleamtea/keybind

A bubble: key bindings (the key package in charmbracelet/bubbles).

Declare a binding once, then reuse it both to match incoming keys (matches) and to render help (via gleamtea/help).

Types

An opaque key binding.

pub type Binding

Values

pub fn help(binding: Binding) -> #(String, String)

The #(key_label, description) help pair.

pub fn matches(key: key.Key, binding: Binding) -> Bool

Does key trigger this binding? (Always False when disabled.)

pub fn matches_any(key: key.Key, bindings: List(Binding)) -> Bool

Does key match any binding in the list?

pub fn new(
  keys: List(key.Key),
  help: #(String, String),
) -> Binding

A binding over keys, with a #(key_label, description) help pair, e.g. new([Left, Char(104)], #("←/h", "prev page")).

pub fn set_enabled(enabled: Bool, binding: Binding) -> Binding

Enable/disable a binding.

Search Document