Documentation
¶
Overview ¶
Package keys defines the enumerated KeyName values that identify built-in actions and the GlobalkeyBindings map used to render them in the menu bar.
This package is not the dispatch authority. At runtime, key input is routed through [script.Engine] using the bindings declared in script/defaults.lua plus any user scripts under ~/.loom/scripts/*.lua. KeyForString is a reverse lookup used only for menu-bar highlighting, so scripts can rebind a key without disturbing menu rendering.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var GlobalkeyBindings = map[KeyName]key.Binding{ KeyUp: key.NewBinding( key.WithKeys("up", "k"), key.WithHelp("↑/k", "up"), ), KeyDown: key.NewBinding( key.WithKeys("down", "j"), key.WithHelp("↓/j", "down"), ), KeyNew: key.NewBinding( key.WithKeys("n"), key.WithHelp("n", "new"), ), KeyKill: key.NewBinding( key.WithKeys("D"), key.WithHelp("D", "kill"), ), KeyHelp: key.NewBinding( key.WithKeys("?"), key.WithHelp("?", "help"), ), KeyQuit: key.NewBinding( key.WithKeys("q"), key.WithHelp("q", "quit"), ), KeySubmit: key.NewBinding( key.WithKeys("p"), key.WithHelp("p", "push branch"), ), KeyPrompt: key.NewBinding( key.WithKeys("N"), key.WithHelp("N", "new with prompt"), ), KeyCheckout: key.NewBinding( key.WithKeys("c"), key.WithHelp("c", "checkout"), ), KeyResume: key.NewBinding( key.WithKeys("r"), key.WithHelp("r", "resume"), ), KeyWorkspace: key.NewBinding( key.WithKeys("W"), key.WithHelp("W", "workspace"), ), KeyWorkspaceLeft: key.NewBinding( key.WithKeys("[", "l"), key.WithHelp("[/l", "prev ws"), ), KeyWorkspaceRight: key.NewBinding( key.WithKeys("]", ";"), key.WithHelp("]/;", "next ws"), ), KeyFullScreenAttachAgent: key.NewBinding( key.WithKeys("alt+a"), key.WithHelp("alt+a", "fullscreen agent"), ), KeyFullScreenAttachTerminal: key.NewBinding( key.WithKeys("alt+t"), key.WithHelp("alt+t", "fullscreen terminal"), ), KeyDiff: key.NewBinding( key.WithKeys("d"), key.WithHelp("d", "diff"), ), KeyQuickInputAgent: key.NewBinding( key.WithKeys("a"), key.WithHelp("a", "input to agent"), ), KeyQuickInputTerminal: key.NewBinding( key.WithKeys("t"), key.WithHelp("t", "input to terminal"), ), KeyDirectAttachAgent: key.NewBinding( key.WithKeys("ctrl+a"), key.WithHelp("ctrl+a", "attach agent"), ), KeyDirectAttachTerminal: key.NewBinding( key.WithKeys("ctrl+t"), key.WithHelp("ctrl+t", "attach terminal"), ), KeySubmitName: key.NewBinding( key.WithKeys("enter"), key.WithHelp("enter", "submit name"), ), }
GlobalkeyBindings is the global, immutable table of built-in bindings used by the help panel and menu-bar highlighter. It mirrors the defaults in script/defaults.lua — the Lua table is authoritative for dispatch, this map is for UI rendering only. Keep the two in sync when adding or changing a binding; the migration_parity_test.go guard catches drift.
Functions ¶
This section is empty.
Types ¶
type KeyName ¶
type KeyName int
KeyName is the enum identifier used by the help panel and menu-bar highlighter to refer to a built-in binding. It is NOT the dispatch authority — that lives in script/defaults.lua, which can rebind any key at will. KeyName values are stable across releases; binding values in GlobalkeyBindings may change.
const ( KeyUp KeyName = iota KeyDown KeyNew KeyKill KeyQuit KeySubmit KeySubmitName KeyCheckout KeyResume KeyPrompt KeyHelp KeyWorkspace KeyWorkspaceLeft KeyWorkspaceRight KeyFullScreenAttachAgent KeyFullScreenAttachTerminal KeyDiff KeyQuickInputAgent KeyQuickInputTerminal KeyDirectAttachAgent KeyDirectAttachTerminal )
KeyUp through KeyDirectAttachTerminal enumerate the built-in keybindings surfaced in GlobalkeyBindings. They drive the help panel and menu-bar highlighter; dispatch itself is owned by script/defaults.lua, which may rebind any key. KeyDirectAttachAgent and KeyDirectAttachTerminal are reserved to stateDefault so they do not collide with textinput's ctrl+a (LineStart) binding in stateQuickInteract.
func KeyForString ¶
KeyForString returns the KeyName bound to s via GlobalkeyBindings, or (0, false) when the string is not a built-in binding.