Skip to content

feat: allow choosing editor in configuration file - #955

Open
Metbcy wants to merge 1 commit into
charmbracelet:masterfrom
Metbcy:feat/gh-944-editor-config
Open

feat: allow choosing editor in configuration file#955
Metbcy wants to merge 1 commit into
charmbracelet:masterfrom
Metbcy:feat/gh-944-editor-config

Conversation

@Metbcy

@Metbcy Metbcy commented May 23, 2026

Copy link
Copy Markdown

Closes #944.

Adds an editor key to glow.yml so users can pick the editor used by glow config and the in-TUI e key without having to override $EDITOR globally. The use case from the issue is wanting micro for markdown while keeping vim as the system default.

Behavior

# editor used to open files (defaults to $EDITOR, or "nano" if unset).
# Accepts an editor name or a command with flags, e.g. "code --wait".
editor: ""
  • editor: "micro" → glow uses micro, ignoring $EDITOR.
  • editor: "code --wait" → multi-token commands work (the x/editor package already splits on whitespace).
  • editor: "" or unset → existing $EDITORnano fallback chain is untouched.

Implementation note

When the key is set, the value is applied to glow's own process environment in validateOptions before editor.Cmd runs. This keeps the diff tiny (no plumbing through ui.Config, no fork of the upstream charmbracelet/x/editor package) and only mutates glow's own process, so the user's shell $EDITOR is not affected.

Verified locally

  • editor: "/bin/echo override" + a stub EDITOR → fake editor invoked with the config file path.
  • editor: "" + EDITOR=/bin/echo$EDITOR is used.
  • go build ./..., go vet ./..., go test ./... all pass.

Adds an `editor` key to glow.yml so users can pick the editor used by
`glow config` and the in-TUI 'e' key without having to override $EDITOR
globally. Useful for cases like preferring `micro` for markdown while
keeping `vim` as the system default.

When set, the value is applied to glow's own process environment before
the embedded `charmbracelet/x/editor` package is invoked, so the existing
$EDITOR / nano fallback chain remains intact when the key is empty or
absent. The override does not leak into the user's shell.

Closes charmbracelet#944
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow to choose editor in configuration file

1 participant