mappings

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionMappingConfig

type ActionMappingConfig struct {
	ID          string `yaml:"id"`
	Description string `yaml:"description"`
	Name        string `yaml:"name"`
	// Featured means that this action is implemented within one or few editors and is not portable
	Featured bool `yaml:"featured"`
	// FeaturedReason: Why this action is not common across editors, or recommand users to use another portable actioin of similar utility.
	FeaturedReason string                `yaml:"featuredReason"`
	Category       string                `yaml:"category"`
	VSCode         VscodeConfigs         `yaml:"vscode"`
	Zed            ZedConfigs            `yaml:"zed"`
	IntelliJ       IntelliJMappingConfig `yaml:"intellij"`
	Vim            VimMappingConfig      `yaml:"vim"`
	Helix          HelixConfig           `yaml:"helix"`
	Xcode          XcodeConfigs          `yaml:"xcode"`
}

ActionMappingConfig holds the complete mapping information for a single action ID.

func (*ActionMappingConfig) IsSupported added in v0.2.0

func (am *ActionMappingConfig) IsSupported(editorType pluginapi.EditorType) (bool, string)

IsSupported checks if the action is supported by the given editor type. Returns (supported, notSupportedReason).

type DuplicateActionMappingError

type DuplicateActionMappingError struct {
	Editor string
	// editor action name -> all involved universal action ids
	Duplicates map[string][]string
}

func (*DuplicateActionMappingError) Error

type EditorActionMapping

type EditorActionMapping struct {
	// when true, this config is only used for export, otherwise it is used for both import and export
	DisableImport bool `yaml:"disableImport,omitempty"`

	// explicitly set to true if this config is not supported by the editor
	NotSupported bool `yaml:"notSupported,omitempty"`
	// reason why this config is not supported by the editor
	NotSupportedReason string `yaml:"notSupportedReason,omitempty"`
}

EditorActionMapping provides extra flags for editor-specific configurations.

type HelixConfig

type HelixConfig []HelixMappingConfig

func (*HelixConfig) UnmarshalYAML

func (h *HelixConfig) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML implements the yaml.Unmarshaler interface for HelixConfigs. It supports both a single mapping object and a sequence of objects.

type HelixMappingConfig

type HelixMappingConfig struct {
	EditorActionMapping `yaml:",inline"`

	Command string `yaml:"command"`
	Mode    string `yaml:"mode"`
}

type IntelliJMappingConfig

type IntelliJMappingConfig struct {
	EditorActionMapping `yaml:",inline"`

	Action string `yaml:"action"`
}

type MappingConfig

type MappingConfig struct {
	// Mappings is a map where the key is the one_keymap_id (e.g., "actions.editor.copy")
	// and the value is the detailed mapping information for that action.
	Mappings map[string]ActionMappingConfig
}

MappingConfig holds the final, merged mapping config, indexed by action ID. It serves as a `Anemic Domain Model` because I want the editor specific config query to be implemented in plugin.

func NewMappingConfig

func NewMappingConfig() (*MappingConfig, error)

func NewTestMappingConfig

func NewTestMappingConfig() (*MappingConfig, error)

func (*MappingConfig) Get added in v0.3.0

func (mc *MappingConfig) Get(actionID string) *ActionMappingConfig

Get searches for a mapping by universal action ID.

func (*MappingConfig) IsActionMapped

func (mc *MappingConfig) IsActionMapped(action string) bool

IsActionMapped checks if a universal action ID is defined in the mapping configuration.

type VimMappingConfig

type VimMappingConfig struct {
	EditorActionMapping `yaml:",inline"`

	Command string `yaml:"command"`
	Mode    string `yaml:"mode"`
}

type VscodeConfigs

type VscodeConfigs []VscodeMappingConfig

VscodeConfigs is a slice of VscodeMappingConfig that can be unmarshalled from either a single YAML object or a sequence of objects.

func (*VscodeConfigs) UnmarshalYAML

func (v *VscodeConfigs) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML implements the yaml.Unmarshaler interface.

type VscodeMappingConfig

type VscodeMappingConfig struct {
	EditorActionMapping `yaml:",inline"`

	Command string                 `yaml:"command"`
	When    string                 `yaml:"when"`
	Args    map[string]interface{} `yaml:"args,omitempty"`
}

VscodeMappingConfig defines the structure for VSCode's mapping, including the command and its context.

type XcodeConfigs added in v0.5.2

type XcodeConfigs []XcodeMappingConfig

XcodeConfigs is a slice of XcodeMappingConfig that can be unmarshalled from either a single YAML object or a sequence of objects.

func (*XcodeConfigs) UnmarshalYAML added in v0.5.2

func (x *XcodeConfigs) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML implements the yaml.Unmarshaler interface.

type XcodeMappingConfig added in v0.5.2

type XcodeMappingConfig struct {
	EditorActionMapping `yaml:",inline"`

	// The Xcode text action name for Text Key Bindings (e.g., "pageDown:", "deleteBackward:")
	TextAction string `yaml:"textAction,omitempty"`

	// The Xcode action name (e.g., "moveWordLeft:", "selectWord:")
	Action string `yaml:"action"`
	// The command group ID
	CommandGroupID string `yaml:"commandGroupID,omitempty"`
	// The Xcode command ID for menu bindings (optional)
	CommandID string `yaml:"commandID,omitempty"`
	// Whether this is an alternate key binding
	Alternate string `yaml:"alternate,omitempty"`
	// The menu group this action belongs to
	Group string `yaml:"group,omitempty"`
	// The menu group ID
	GroupID string `yaml:"groupID,omitempty"`
	// Whether this is a grouped alternate key binding
	GroupedAlternate string `yaml:"groupedAlternate,omitempty"`
	// Whether this is a navigation action
	Navigation string `yaml:"navigation,omitempty"`
	// The parent title for nested menu items
	ParentTitle string `yaml:"parentTitle,omitempty"`
	// The title of the action
	Title string `yaml:"title,omitempty"`
}

XcodeMappingConfig defines the structure for Xcode's mapping, including the action and optional command context.

type ZedConfigs

type ZedConfigs []ZedMappingConfig

func (*ZedConfigs) UnmarshalYAML

func (z *ZedConfigs) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML implements the yaml.Unmarshaler interface for ZedConfigs. It supports both a single mapping object and a sequence of objects.

type ZedMappingConfig

type ZedMappingConfig struct {
	EditorActionMapping `yaml:",inline"`

	Action  string                 `yaml:"action"`
	Context string                 `yaml:"context"`
	Args    map[string]interface{} `yaml:"args,omitempty"`
}

Jump to

Keyboard shortcuts

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