editor

package
v0.0.0-...-edd6424 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: Apache-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package editor opens a file in the user's editor: for `strument config edit`, `strument history edit`, and the REPL's /editor.

The resolution order is age-edit's (github.com/dbohdan/age-edit) without its tool-specific variable: VISUAL, then EDITOR, then a default. Same order and the same treatment of the value — an argv, split on shell rules, never a string handed to a shell. The default is where this parts company with age-edit, which says vi everywhere; see fallbackEditors.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Argv

func Argv(path string, lookup func(string) string) []string

Argv is the command that opens path.

$VISUAL and $EDITOR are commands, not program names — `code --wait`, `emacsclient -nw`, `"/opt/My Editor/bin/ed" --wait` — so the value is split the way a shell would split it and executed directly. Not passed to a shell: a path with a space or a dollar sign in it would then be the shell's problem rather than ours, and this is exactly the seam where the difference bites.

Whitespace-only is treated as unset. An editor variable set to " " is somebody's stray quoting, not a request to run a program with no name.

func ArgvFor

func ArgvFor(path string, lookup func(string) string, look func(string) (string, error), goos string) []string

ArgvFor is Argv with the environment, the PATH search and the platform all named rather than taken from the host.

The seam exists for the same reason shlex.SplitWith's does: the branch that is easiest to get wrong is the one CI is least likely to exercise the way a user meets it, so both platforms' answers have to be reachable from a test on either host.

func Run

func Run(argv []string) error

Run runs argv, the command Argv built, and waits, wiring the editor to the real terminal.

The editor inherits the whole environment, deliberately. The rule in AGENTS.md is about who caused the command: everything the *model* causes runs under the env_allow filter, and everything the *user* typed inherits everything, because they typed it. `strument config edit` is the user reaching for their own editor, which may well read a variable this program has never heard of.

Types

This section is empty.

Jump to

Keyboard shortcuts

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