Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ActionDescription ¶
ActionDescription returns a human-readable description for an action.
func ScopeLabel ¶
ScopeLabel returns a human-readable label for a scope.
Types ¶
type Action ¶
type Action string
Action represents a user action that can be triggered by a keybinding.
const ( // Global actions ActionQuit Action = "quit" ActionForceQuit Action = "force_quit" ActionHelp Action = "help" ActionFocusLeft Action = "focus_left" ActionFocusRight Action = "focus_right" ActionFocusToggle Action = "focus_toggle" ActionViewAgent Action = "view_agent" ActionViewDiff Action = "view_diff" ActionViewPlan Action = "view_plan" ActionNewSession Action = "new_session" ActionStopSession Action = "stop_session" ActionRestartSession Action = "restart_session" // Sidebar actions ActionMoveUp Action = "move_up" ActionMoveDown Action = "move_down" ActionSelect Action = "select" ActionToggle Action = "toggle" ActionDeleteSession Action = "delete_session" // Agent view actions ActionEnterInput Action = "enter_input" ActionExitInput Action = "exit_input" // Diff view actions ActionOpenEditor Action = "open_editor" ActionOpenEditorAtLine Action = "open_editor_at_line" ActionPageDown Action = "page_down" ActionPageUp Action = "page_up" ActionCursorUp Action = "cursor_up" ActionCursorDown Action = "cursor_down" ActionJumpTop Action = "jump_top" ActionJumpBottom Action = "jump_bottom" ActionSearchStart Action = "search_start" ActionSearchNext Action = "search_next" ActionSearchPrev Action = "search_prev" ActionComment Action = "comment" ActionSendComments Action = "send_comments" ActionRefreshDiff Action = "refresh_diff" ActionColumnLeft Action = "column_left" ActionColumnRight Action = "column_right" ActionEditComment Action = "edit_comment" // Terminal split ActionOpenTerminal Action = "open_terminal" ActionToggleTerminalFocus Action = "toggle_terminal_focus" // Mouse toggle ActionToggleMouse Action = "toggle_mouse" // No-op ActionNone Action = "" )
type Binding ¶
type Binding struct {
Key string `json:"key"`
Action Action `json:"action"`
Scope Scope `json:"scope"`
}
Binding maps a key string to an action within a scope.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler resolves key messages to actions based on the current scope. Supports leader key sequences for accessing application commands.
func NewHandler ¶
NewHandler creates a new key handler with Space as the default leader key.
func NewHandlerWithLeader ¶
NewHandlerWithLeader creates a handler with a custom leader key. Pass an empty string to disable leader key functionality.
func (*Handler) Handle ¶
Handle resolves a key message to an action. Supports leader key sequences: if leader key is pressed, waits for next key and tries to resolve "<leader>+<next_key>" binding first.
func (*Handler) InLeaderMode ¶
InLeaderMode returns true if we're waiting for the next key in a leader sequence. This can be used to show visual feedback (e.g., in status bar).
func (*Handler) SetLeaderKey ¶
SetLeaderKey updates the leader key. Pass empty string to disable leader functionality.
type KeyMap ¶
type KeyMap struct {
// contains filtered or unexported fields
}
KeyMap holds all keybindings grouped by scope.
func Merge ¶
Merge creates a new KeyMap with user bindings overriding defaults. User bindings with the same scope+key replace the default.
func (*KeyMap) BindingsForScope ¶
BindingsForScope returns all bindings for a given scope.