Skip to content

smelt.keymap

Tier: UiHost — Requires a terminal UI; calling these from headless mode raises.

Register chord→callback bindings and inspect the layered help index. Chords and modes are canonicalized at registration; unknown values raise immediately. UiHost-only.

smelt.keymap.help_sections

fun(): table

Return layered keybinding help as { title, entries = { { label, detail } } } rows. Filters vim-only chords when vim mode is disabled.

smelt.keymap.list

fun(): table

Return the set of currently-bound { mode, chord } rows. mode is the canonical short form ("n"/"i"/"v"/"").

smelt.keymap.set

fun(mode: string, chord: string, handler: fun()): smelt.Reg

Types: smelt.Reg

Bind chord in mode to a Lua callback. mode is "n"|"i"|"v"|"" (or the long form normal/insert/visual); the chord is canonicalized at registration and unknown values raise immediately. Re-binding the same (mode, chord) overwrites the prior handler. Returns a Reg whose :remove() drops the binding.

smelt.keymap.unset

fun(mode: string, chord: string): boolean

Drop the binding for chord in mode. mode accepts the same forms as set. Returns true if a binding was removed.