Skip to content

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

Description

@nextgenthemes

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    status:needs-triageAn issue that hasn't had any proper look

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions