forked from extern/nushell
Fallback for config.buffer_editor
from EDITOR
(#5614)
For the reedline `buffer_editor` use the `EDITOR` and `VISUAL` environment variables as fallback. Same resolution order as #5607 Closes #5430
This commit is contained in:
parent
6ff717c0ba
commit
0e1bfae13d
@ -159,7 +159,26 @@ pub fn evaluate_repl(
|
||||
}
|
||||
};
|
||||
|
||||
line_editor = line_editor.with_buffer_editor(config.buffer_editor.clone(), "nu".into());
|
||||
let buffer_editor = if !config.buffer_editor.is_empty() {
|
||||
Some(config.buffer_editor.clone())
|
||||
} else {
|
||||
stack
|
||||
.get_env_var(engine_state, "EDITOR")
|
||||
.map(|v| v.as_string().unwrap_or_default())
|
||||
.filter(|v| !v.is_empty())
|
||||
.or_else(|| {
|
||||
stack
|
||||
.get_env_var(engine_state, "VISUAL")
|
||||
.map(|v| v.as_string().unwrap_or_default())
|
||||
.filter(|v| !v.is_empty())
|
||||
})
|
||||
};
|
||||
|
||||
line_editor = if let Some(buffer_editor) = buffer_editor {
|
||||
line_editor.with_buffer_editor(buffer_editor, "nu".into())
|
||||
} else {
|
||||
line_editor
|
||||
};
|
||||
|
||||
if config.sync_history_on_enter {
|
||||
if is_perf_true {
|
||||
|
@ -190,7 +190,7 @@ let-env config = {
|
||||
completion_algorithm: "prefix" # prefix, fuzzy
|
||||
animate_prompt: false # redraw the prompt every second
|
||||
float_precision: 2
|
||||
buffer_editor: "emacs" # command that will be used to edit the current line buffer with ctrl+o
|
||||
# buffer_editor: "emacs" # command that will be used to edit the current line buffer with ctrl+o, if unset fallback to $env.EDITOR and $env.VISUAL
|
||||
use_ansi_coloring: true
|
||||
filesize_format: "auto" # b, kb, kib, mb, mib, gb, gib, tb, tib, pb, pib, eb, eib, zb, zib, auto
|
||||
edit_mode: emacs # emacs, vi
|
||||
|
Loading…
Reference in New Issue
Block a user