Skip to content

Conversation

@jeanlaurent
Copy link
Member

@jeanlaurent jeanlaurent commented Jan 7, 2026

Expand $EDITOR to actual editor name in TUI help text

The TUI help footer now displays the actual configured editor name instead of the literal
string "$EDITOR".

Before: Ctrl+g edit in $EDITOR
After: Ctrl+g edit in VSCode (or Vim, Neovim, Cursor, etc.)

The implementation:

  • Reads VISUAL or EDITOR environment variables
  • Extracts base command name from paths and arguments
  • Maps common editors (code, vim, nvim, cursor, etc.) to friendly display names
  • Falls back to capitalized base name for unknown editors
  • Returns "$EDITOR" if not configured

so moving from
Screenshot 2026-01-07 at 19 33 50
to
Screenshot 2026-01-07 at 19 34 22

@jeanlaurent jeanlaurent requested a review from a team as a code owner January 7, 2026 18:33
"zed": "Zed",
}

if displayName, ok := editorNames[baseName]; ok {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to check if it starts with, an $EDITOR coud be code --wait for example

@@ -0,0 +1,50 @@
version: 2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error?

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
// Set test env
t.Setenv("VISUAL", "")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you avoid setting env variables in tests? It prevents run running tests in parallel

{
name: "Empty",
envValue: "",
want: "$EDITOR",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me, $EDITOR means vim. Probably a default somewhere. Do you handle that?

@krissetto
Copy link
Contributor

One thing we could add here, or do in a subsequent PR, is removing the footer option altogether for those users that don't have $EDITOR set, since it just flashes the screen atm

Signed-off-by: Jean-Laurent de Morlhon <[email protected]>
@dgageot dgageot merged commit 9285131 into docker:main Jan 8, 2026
5 checks passed
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.

4 participants