Documentation
¶
Index ¶
- func ApplyConfig(r *Registry, cfg *Config)
- func CommandHelp(cmd Command) string
- func ConfigPath(baseDir string) string
- func IsPrintable(key tea.KeyMsg) bool
- func KeyToString(key tea.KeyMsg) string
- func RegisterDefaults(r *Registry)
- func SaveConfig(path string, cfg *Config) error
- type Binding
- type Command
- type Config
- type Context
- type HelpBinding
- type HelpSection
- type Registry
- func (r *Registry) AllContexts() []Context
- func (r *Registry) BindingsByCommand(context Context) map[Command][]string
- func (r *Registry) BindingsForContext(context Context) []Binding
- func (r *Registry) FooterHelp() string
- func (r *Registry) GenerateHelp() string
- func (r *Registry) GenerateTDQHelp() string
- func (r *Registry) HasPending() bool
- func (r *Registry) Lookup(key tea.KeyMsg, activeContext Context) (Command, bool)
- func (r *Registry) ModalFooterHelp() string
- func (r *Registry) PendingKey() string
- func (r *Registry) RegisterBinding(b Binding)
- func (r *Registry) RegisterBindings(bindings []Binding)
- func (r *Registry) ResetPending()
- func (r *Registry) SetUserOverride(context Context, key string, cmd Command)
- func (r *Registry) StatsFooterHelp() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyConfig ¶
ApplyConfig applies user configuration overrides to the registry.
func CommandHelp ¶
CommandHelp returns help info for a specific command
func ConfigPath ¶
ConfigPath returns the path to the keymap config file
func IsPrintable ¶
IsPrintable returns true if the key represents a printable character
func KeyToString ¶
KeyToString converts a tea.KeyMsg to a string representation
func RegisterDefaults ¶
func RegisterDefaults(r *Registry)
RegisterDefaults registers all default bindings with the registry.
func SaveConfig ¶
SaveConfig saves the config to a JSON file.
Types ¶
type Binding ¶
type Binding struct {
Key string // e.g., "tab", "ctrl+d", "g g"
Command Command // Command ID
Context Context // "global", "main", "modal", etc.
Description string // Human-readable description for help text
}
Binding maps a key or key sequence to a command in a specific context
func DefaultBindings ¶
func DefaultBindings() []Binding
DefaultBindings returns the default key bindings for the monitor TUI. Bindings are organized by context and follow vim conventions where applicable.
type Command ¶
type Command string
Command represents a named command that can be triggered by key bindings
const ( // Global commands CmdQuit Command = "quit" CmdToggleHelp Command = "toggle-help" CmdRefresh Command = "refresh" // Navigation commands CmdNextPanel Command = "next-panel" CmdPrevPanel Command = "prev-panel" CmdFocusPanel1 Command = "focus-panel-1" CmdFocusPanel2 Command = "focus-panel-2" CmdFocusPanel3 Command = "focus-panel-3" CmdCursorDown Command = "cursor-down" CmdCursorUp Command = "cursor-up" CmdCursorTop Command = "cursor-top" CmdCursorBottom Command = "cursor-bottom" CmdHalfPageDown Command = "half-page-down" CmdHalfPageUp Command = "half-page-up" CmdFullPageDown Command = "full-page-down" CmdFullPageUp Command = "full-page-up" CmdScrollDown Command = "scroll-down" CmdScrollUp Command = "scroll-up" CmdSelect Command = "select" CmdBack Command = "back" CmdClose Command = "close" // Action commands CmdOpenDetails Command = "open-details" CmdOpenStats Command = "open-stats" CmdSearch Command = "search" CmdToggleClosed Command = "toggle-closed" CmdMarkForReview Command = "mark-for-review" CmdApprove Command = "approve" CmdDelete Command = "delete" CmdConfirm Command = "confirm" CmdCancel Command = "cancel" CmdCycleSortMode Command = "cycle-sort-mode" // Search-specific commands CmdSearchConfirm Command = "search-confirm" CmdSearchCancel Command = "search-cancel" CmdSearchClear Command = "search-clear" CmdSearchBackspace Command = "search-backspace" CmdSearchInput Command = "search-input" // Epic task navigation commands CmdFocusTaskSection Command = "focus-task-section" CmdOpenEpicTask Command = "open-epic-task" // Parent epic navigation CmdOpenParentEpic Command = "open-parent-epic" )
All available commands
func AllCommands ¶
func AllCommands() []Command
AllCommands returns all defined commands sorted alphabetically
type Config ¶
type Config struct {
// Bindings maps "context:key" to command ID
// Example: {"main:ctrl+s": "open-stats", "modal:q": "close"}
Bindings map[string]string `json:"bindings"`
}
Config represents user key binding configuration. Stored in .todos/keymap.json
func ExampleConfig ¶
func ExampleConfig() *Config
ExampleConfig returns an example configuration for documentation
func LoadConfig ¶
LoadConfig loads key binding overrides from a JSON file. Returns an empty config if the file doesn't exist.
type Context ¶
type Context string
Context represents a UI context for keybindings
const ( ContextGlobal Context = "global" ContextMain Context = "main" ContextModal Context = "modal" ContextStats Context = "stats" ContextSearch Context = "search" ContextConfirm Context = "confirm" ContextEpicTasks Context = "epic-tasks" // When task list in epic modal is focused ContextParentEpicFocused Context = "parent-epic-focused" // When parent epic row is focused )
type HelpBinding ¶
HelpBinding represents a single binding for display
type HelpSection ¶
type HelpSection struct {
Title string
Bindings []HelpBinding
}
HelpSection represents a group of bindings in help text
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry manages key bindings and command dispatch
func (*Registry) AllContexts ¶
AllContexts returns all contexts that have bindings
func (*Registry) BindingsByCommand ¶
BindingsByCommand groups bindings by command for help generation
func (*Registry) BindingsForContext ¶
BindingsForContext returns all bindings for a given context (including global)
func (*Registry) FooterHelp ¶
FooterHelp generates a compact help string for the footer
func (*Registry) GenerateHelp ¶
GenerateHelp generates help text from the registry bindings
func (*Registry) GenerateTDQHelp ¶
GenerateTDQHelp generates help text for TDQ query language
func (*Registry) HasPending ¶
HasPending returns true if there's a pending key sequence
func (*Registry) Lookup ¶
Lookup finds the command for a given key in the specified context Returns the command and whether a binding was found Checks: user overrides -> context bindings -> global bindings
func (*Registry) ModalFooterHelp ¶
ModalFooterHelp generates help text for the modal footer
func (*Registry) PendingKey ¶
PendingKey returns the current pending key (for UI display)
func (*Registry) RegisterBinding ¶
RegisterBinding adds a key binding
func (*Registry) RegisterBindings ¶
RegisterBindings adds multiple key bindings
func (*Registry) ResetPending ¶
func (r *Registry) ResetPending()
ResetPending clears any pending key sequence
func (*Registry) SetUserOverride ¶
SetUserOverride sets a user-configured key override for a specific context
func (*Registry) StatsFooterHelp ¶
StatsFooterHelp generates help text for the stats modal footer