keybind

package
v0.14.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 23, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package keybind is the name-indexed key-rebinding registry: a map of stable lower-case names to bubbles key.Binding pointers, with config-driven overrides and enumeration. The semantics are deliberate and shared by any app that adopts it: an empty override is ignored so a partial config never silently unbinds an action, the first override key becomes the help label while the description is kept, and an unknown name is an error rather than a silent no-op so a config typo surfaces. The package knows nothing about which bindings exist — the owner declares its own key map struct and hands in the pointers — so it lifts cleanly into any Bubble Tea app.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Registry

type Registry map[string]*key.Binding

Registry maps stable lower-case names to the owner's binding fields. Values are pointers so Rebind mutates the owner's key map in place; build the registry from the same struct the app reads bindings off.

func (Registry) Names

func (r Registry) Names() []string

Names returns every rebindable binding name, sorted. Useful for docs and for validating a config file's keybinding overrides.

func (Registry) Rebind

func (r Registry) Rebind(overrides map[string][]string) error

Rebind applies user overrides keyed by binding name (e.g. {"transition": {"x"}}). An empty key slice is ignored so a partial config never silently unbinds an action. The first key becomes the help label; the description is kept. An unknown name is an error rather than a silent no-op, so a typo in a config file is surfaced — and it is checked before anything mutates, so a failed Rebind leaves every binding exactly as it was.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL