mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 22:50:14 +02:00
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:
committed by
GitHub
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 {
|
||||
|
Reference in New Issue
Block a user