Documentation
¶
Overview ¶
Package editor provides utilities for opening files in the user's preferred editor.
Package editor provides utilities for opening files in the user's preferred editor. It supports automatic detection of editors on Windows, macOS, and Linux.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDefaultEditor ¶
func GetDefaultEditor() string
GetDefaultEditor returns the name of the detected default editor. Returns empty string if no editor is found.
func IsEditorAvailable ¶
IsEditorAvailable checks if a specific editor is available on the system.
func Open ¶
Open opens the specified file in the user's preferred editor. Uses EDITOR or VISUAL environment variables if set, otherwise auto-detects.
func OpenWithOptions ¶
func OpenWithOptions(path string, opts OpenOptions) error
OpenWithOptions opens a file with custom options.
Types ¶
type OpenOptions ¶
type OpenOptions struct {
// Editor overrides the default editor detection.
// If empty, uses EDITOR, VISUAL env vars, or auto-detects.
Editor string
// WaitForClose blocks until the editor process exits.
// Defaults to true.
WaitForClose bool
// LineNumber opens the file at a specific line (if supported by editor).
LineNumber int
}
OpenOptions configures how to open a file in an editor.