bindings

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load(dir string) (*Map, Source, error)

Load attempts to read bindings from bindings.toml/json in dir. Missing files fall back to defaults.

func NormalizeKeyString

func NormalizeKeyString(raw string) string

NormalizeKeyString converts runtime key strings into canonical form for lookup.

Types

type ActionID

type ActionID string

ActionID uniquely identifies a shortcut action.

var (
	// Action identifiers used across runtime bindings and UI help rendering.
	ActionCycleFocusNext          ActionID = "cycle_focus_next"
	ActionCycleFocusPrev          ActionID = "cycle_focus_prev"
	ActionOpenEnvSelector         ActionID = "open_env_selector"
	ActionShowGlobals             ActionID = "show_globals"
	ActionClearGlobals            ActionID = "clear_globals"
	ActionSaveFile                ActionID = "save_file"
	ActionSaveLayout              ActionID = "save_layout"
	ActionToggleResponseSplitVert ActionID = "toggle_response_split_vertical"
	ActionToggleResponseSplitHorz ActionID = "toggle_response_split_horizontal"
	ActionTogglePaneFollowLatest  ActionID = "toggle_pane_follow_latest"
	ActionToggleHelp              ActionID = "toggle_help"
	ActionShowContextHelp         ActionID = "show_context_help"
	ActionShowRequestDetails      ActionID = "show_request_details"
	ActionShowStatusMessage       ActionID = "show_status_message"
	ActionOpenPathModal           ActionID = "open_path_modal"
	ActionReloadWorkspace         ActionID = "reload_workspace"
	ActionOpenNewFileModal        ActionID = "open_new_file_modal"
	ActionOpenFileInEditor        ActionID = "open_file_in_editor"
	ActionOpenThemeSelector       ActionID = "open_theme_selector"
	ActionOpenTempDocument        ActionID = "open_temp_document"
	ActionReparseDocument         ActionID = "reparse_document"
	ActionReloadFileFromDisk      ActionID = "reload_file_from_disk"
	ActionSelectTimelineTab       ActionID = "select_timeline_tab"
	ActionQuitApp                 ActionID = "quit_app"
	ActionSidebarWidthDecrease    ActionID = "sidebar_width_decrease"
	ActionSidebarWidthIncrease    ActionID = "sidebar_width_increase"
	ActionSidebarHeightDecrease   ActionID = "sidebar_height_decrease"
	ActionSidebarHeightIncrease   ActionID = "sidebar_height_increase"
	ActionWorkflowHeightIncrease  ActionID = "workflow_height_increase"
	ActionWorkflowHeightDecrease  ActionID = "workflow_height_decrease"
	ActionFocusRequests           ActionID = "focus_requests"
	ActionFocusResponse           ActionID = "focus_response"
	ActionFocusEditorNormal       ActionID = "focus_editor_normal"
	ActionSetMainSplitHorizontal  ActionID = "set_main_split_horizontal"
	ActionSetMainSplitVertical    ActionID = "set_main_split_vertical"
	ActionStartCompareRun         ActionID = "start_compare_run"
	ActionToggleWebsocketConsole  ActionID = "toggle_ws_console"
	ActionToggleSidebarCollapse   ActionID = "toggle_sidebar_collapse"
	ActionToggleEditorCollapse    ActionID = "toggle_editor_collapse"
	ActionToggleResponseCollapse  ActionID = "toggle_response_collapse"
	ActionToggleZoom              ActionID = "toggle_zoom"
	ActionClearZoom               ActionID = "clear_zoom"
	ActionSendRequest             ActionID = "send_request"
	ActionExplainRequest          ActionID = "explain_request"
	ActionCancelRun               ActionID = "cancel_run"
	ActionCopyResponseTab         ActionID = "copy_response_tab"
	// Legacy compatibility action kept so existing binding files continue to load.
	ActionToggleHeaderPreview    ActionID = "toggle_header_preview"
	ActionCycleRawView           ActionID = "cycle_raw_view"
	ActionShowRawDump            ActionID = "show_raw_dump"
	ActionScrollResponseTop      ActionID = "scroll_response_top"
	ActionScrollResponseBottom   ActionID = "scroll_response_bottom"
	ActionSaveResponseBody       ActionID = "save_response_body"
	ActionOpenResponseExternally ActionID = "open_response_externally"
	ActionToggleMockServer       ActionID = "toggle_mock_server"
	ActionCaptureMockResponse    ActionID = "capture_mock_response"
)

type Binding

type Binding struct {
	Action     ActionID
	Steps      []string
	Repeatable bool
}

Binding represents a resolved shortcut binding.

type Format

type Format string

Format identifies the serialization format for shortcut configs.

const (
	FormatTOML Format = "toml"
	FormatJSON Format = "json"
)

type Map

type Map struct {
	// contains filtered or unexported fields
}

Map stores runtime shortcut bindings and lookup helpers.

func DefaultMap

func DefaultMap() *Map

DefaultMap builds the built-in bindings without consulting disk.

func (*Map) Bindings

func (m *Map) Bindings(action ActionID) []Binding

Bindings returns a copy of every binding for the provided action.

func (*Map) HasChordPrefix

func (m *Map) HasChordPrefix(key string) bool

HasChordPrefix reports whether the given key can start a chord sequence.

func (*Map) MatchSingle

func (m *Map) MatchSingle(key string) (Binding, bool)

MatchSingle returns the binding bound to a single-step shortcut, if any.

func (*Map) ResolveChord

func (m *Map) ResolveChord(prefix, next string) (Binding, bool)

ResolveChord resolves a chord prefix + next key into a binding.

type Source

type Source struct {
	Path   string
	Format Format
}

Source describes where the bindings config was loaded from.

Jump to

Keyboard shortcuts

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