nushell / nushell/nushell

VISUAL, EDITOR, SUDO_EDITOR env vars fail with --switches

Open
#18,675 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status:needs-triage
Dominant language
Rust
Stars
40.5k
Forks
2.3k
Avg merge
1d 19h
Merged PRs (30d)
85

Description

Bug report form
  • I have done a basic search of the issue tracker to find any existing issues that are similar.
  • I have checked that my version is at least the latest stable release available via my installation method.
Describe the bug

Long story short: this should not be necessary / automatic. When these variables are set as strings, as they just ARE. Nushell fails on them. Nushell expect a list of strings for commands with flags or subcommands. But in these cases It's not very intuitive

#env.nu

# Fix for broken editor integration in Nushell.
#
# Our environment exports VISUAL/EDITOR as a command plus arguments (e.g.
# "codium --wait"), which zsh splits implicitly but Nushell treats as a single
# program name. Nushell's built-in `config` command (and similar) expect the
# editor as a list like ['codium', '--wait'], so split on spaces and keep the
# command together with all its switches.
$env.EDITOR      = ($env.EDITOR? | default "nano"          | str trim | split row " " | where {|el| $el != "" })
$env.VISUAL      = ($env.VISUAL? | default "codium --wait" | str trim | split row " " | where {|el| $el != "" })
$env.SUDO_EDITOR = ($env.VISUAL? | default "codium --wait" | str trim | split row " " | where {|el| $el != "" })
How to reproduce
❯ $env.VISUAL = "codium --wait"

~ 
❯ config nu
Error: nu::shell::external_command

  × External command failed
   ╭─[repl_entry #10:1:1]
 1 │ config nu
   · ────┬────
   ·     ╰── `codium --wait` not found
   ╰────
  help: Failed to find the editor executable


~ 
❯ 

~ 
❯ $env.VISUAL = [ "codium" "--wait" ]

~ 
❯ config nu # works

Expected behavior

Nushell expect a list of strings for commands with flags or subcommands. But in these cases It's not very intuitive

Configuration

version | transpose key value | to md --pretty

key value
version 0.114.2-nightly.7
major 0
minor 114
patch 2
pre nightly.7
branch nightly
commit_hash c41a2b62abe465393be68734dcdc27273672b75e
build_os linux-x86_64
build_target x86_64-unknown-linux-musl
rust_version rustc 1.95.0 (59807616e 2026-04-14)
rust_channel 1.95.0-x86_64-unknown-linux-gnu
cargo_version cargo 1.95.0 (f2d3ce0bd 2026-03-21)
build_time 2026-07-18 03:35:58 +00:00
build_rust_channel release
allocator standard
features default, lsp, mcp, network, plugin, rustls-tls, sqlite, static-link-openssl, trash-support
installed_plugins
experimental_options example=false, dc-glob=false, reorder-cell-paths=true, pipefail=true, enforce-runtime-annotations=true, native-clip=false, cell-path-types=false

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the config nu command's editor lookup for VISUAL, EDITOR, and SUDO_EDITOR, using the reproduction with codium --wait. Determine how string-valued environment variables are handled versus lists, then verify that editor commands containing switches work without manual conversion.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.