Documentation
¶
Overview ¶
Package editorname resolves the user's configured external editor (VISUAL or EDITOR): a friendly display name used in TUI key-binding hints, and the command that launches the editor over a file.
The environment-reading entry points are thin wrappers over pure functions (FromEnv, CommandFromEnv) that take the raw variable values as parameters, so every code path is testable across platforms and editor configurations without touching the actual process environment.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Command ¶ added in v1.119.0
Command builds the *exec.Cmd that opens path in the configured external editor, reading VISUAL and EDITOR from the process environment.
func CommandFromEnv ¶ added in v1.119.0
CommandFromEnv builds the editor command from raw environment values so tests can exercise every code path without mutating os.Environ. VISUAL wins over EDITOR; the chosen value is split on whitespace (strings.Fields, deliberately no shell evaluation), extra tokens become leading arguments, and path is appended last. When neither variable yields a command, the platform default is launched ("notepad" on Windows, "vi" elsewhere).
Stdin/Stdout/Stderr are bound to the real terminal files: left nil, tea.ExecProcess fills them from the Program, whose output is the non-*os.File image-writer wrapper — the editor would then see a pipe instead of a TTY ("Vim: Warning: Output is not to a terminal").
func FromEnv ¶
FromEnv returns a friendly display name for the configured external editor. It reads VISUAL first, then falls back to EDITOR. When neither is set, it returns the platform-specific fallback ("Notepad" on Windows, "Vi" elsewhere) that matches the actual command that will be launched.
FromEnv is pure: it takes the raw environment values as parameters so that tests can exercise every code path without mutating os.Environ.
Types ¶
This section is empty.