nushell/crates/nu-command/src/env
Stefan Holderbach 80a183dde2
Fix editor config for reedline and config nu/env (#10535)
# Description
This merges @horasal 's changes from #10246 and #10269

Closes #10205
Closes #8714

Fixes the bug that editor paths with spaces are unusable

Closes #10210 
Closes #10269


# User-Facing Changes
You can now either pass a string with the name of the executable or a
list with the executable and any flags to
`$env.config.buffer_editor`/`$env.EDITOR`/`$env.VISUAL`

Both the external buffer editor of reedline (by default bound to
`Ctrl-o`) and the commands `config nu` and `config env` will respect
those variables in the following order:
1. `$env.config.buffer_editor`
2. `$env.EDITOR`
3. `$env.VISUAL`

Example:
```
$env.EDITOR = "nvim"                      # The system-wide EDITOR is neovim
$env.config.buffer_editor = ["vim" "-p2"] # Force vim to open two tabs (not particularly useful)
$env.config.buffer_editor = null          # Unset `buffer_editor` -> Uses `$env.EDITOR` ergo nvim
```
# Tests + Formatting
None

---------

Co-authored-by: Horasal <1991933+horasal@users.noreply.github.com>
2023-09-29 16:36:03 +02:00
..
config Fix editor config for reedline and config nu/env (#10535) 2023-09-29 16:36:03 +02:00
export_env.rs Move Value to helpers, separate span call (#10121) 2023-09-03 07:27:29 -07:00
load_env.rs Create Record type (#10103) 2023-08-25 07:50:29 +12:00
mod.rs remove let-env, focus on mutating $env (#9574) 2023-07-01 07:57:51 +12:00
source_env.rs Recursively export constants from modules (#10049) 2023-08-20 14:51:35 +02:00
with_env.rs Create Record type (#10103) 2023-08-25 07:50:29 +12:00