Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNotSupported is returned when a plugin does not support a requested operation, like import or export. ErrNotSupported = errors.New("not supported") )
Functions ¶
This section is empty.
Types ¶
type ConfigDetectOptions ¶
type ConfigDetectOptions struct {
// Whether to in sandbox mode, in sandbox mode, shell command lookup is not effective, like `code` command for vscode can not be found
Sandbox bool
}
ConfigDetectOptions provides configuration for a config detect operation.
type EditorType ¶
type EditorType string
const ( EditorTypeUnknown EditorType = "unknown" // EditorTypeVSCode represents Visual Studio Code editor. EditorTypeVSCode EditorType = "vscode" EditorTypeWindsurf EditorType = "vscode.windsurf" EditorTypeWindsurfNext EditorType = "vscode.windsurf-next" EditorTypeCursor EditorType = "vscode.cursor" // EditorTypeIntelliJ represents IntelliJ IDEA Ultimate editor. EditorTypeIntelliJ EditorType = "intellij" EditorTypeIntelliJCommunity EditorType = "intellij.intellij-community" EditorTypePyCharm EditorType = "intellij.pycharm" EditorTypeWebStorm EditorType = "intellij.webstorm" EditorTypeClion EditorType = "intellij.clion" EditorTypePhpStorm EditorType = "intellij.phpstorm" EditorTypeRubyMine EditorType = "intellij.rubymine" EditorTypeGoLand EditorType = "intellij.goland" EditorTypeZed EditorType = "zed" EditorTypeVim EditorType = "vim" EditorTypeHelix EditorType = "helix" )
func NewEditorTypeFromAPI ¶ added in v0.2.1
func NewEditorTypeFromAPI(e keymapv1.EditorType) EditorType
func (EditorType) AppName ¶ added in v0.2.0
func (e EditorType) AppName() string
AppName returns the human-readable display name for the editor type.
type Plugin ¶
type Plugin interface {
// EditorType returns the unique identifier for the plugin (e.g., "vscode", "zed").
EditorType() EditorType
// ConfigDetect returns the default path to the editor's configuration file based on the platform.
// Return multiple paths if the editor has multiple configuration files.
ConfigDetect(opts ConfigDetectOptions) (paths []string, installed bool, err error)
// Importer returns an instance of PluginImporter for the plugin.
// Return ErrNotSupported if the plugin does not support importing.
Importer() (PluginImporter, error)
// Exporter returns an instance of PluginExporter for the plugin.
// Return ErrNotSupported if the plugin does not support exporting.
Exporter() (PluginExporter, error)
}
Plugin is the core interface that all editor plugins must implement. It defines the contract for importing and exporting keymaps.
type PluginExportOption ¶
type PluginExportOption struct {
// ExistingConfig provides a reader for the editor's current keymap
// configuration. If provided, the exporter will merge the settings
// instead of overwriting the entire file, preserving any keybindings
// not managed by onekeymap. If nil, the export will be destructive,
// creating a new file from scratch.
ExistingConfig io.Reader
}
PluginExportOption provides configuration for an export operation.
type PluginExportReport ¶
type PluginExportReport struct {
// The diff between the base and the exported keymap.
// If base is nil or diff is not supported, this field will be nil.
Diff *string
// If BaseEditorConfig and ExportEditorConfig set, and Diff is not set, export exportService will calculate diff for plugin by using json diff
// BaseEditorConfig contains the original editor-specific configuration before export.
BaseEditorConfig any
// ExportEditorConfig contains the editor-specific configuration after export.
ExportEditorConfig any
}
PluginExportReport details issues encountered during an export operation.
type PluginExporter ¶
type PluginExporter interface {
// Export takes a universal KeymapSetting and writes it to an editor-specific
// configuration destination.
Export(
ctx context.Context,
destination io.Writer,
setting *keymapv1.Keymap,
opts PluginExportOption,
) (*PluginExportReport, error)
}
type PluginImportOption ¶
type PluginImportOption struct {
}
type PluginImporter ¶
Click to show internal directories.
Click to hide internal directories.