diff --git a/Cargo.lock b/Cargo.lock index 263db17c26..39b5a05925 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3716,7 +3716,7 @@ dependencies = [ [[package]] name = "reedline" version = "0.4.0" -source = "git+https://github.com/nushell/reedline?branch=main#2e2bdc54621643e7bee5ba2e2d9bf28e757074e0" +source = "git+https://github.com/nushell/reedline?branch=main#39c70136bb95b50104a57767fbfdde50d7654421" dependencies = [ "chrono", "crossterm", diff --git a/crates/nu-cli/src/repl.rs b/crates/nu-cli/src/repl.rs index 8a86aba86c..f5f5479717 100644 --- a/crates/nu-cli/src/repl.rs +++ b/crates/nu-cli/src/repl.rs @@ -161,6 +161,8 @@ pub fn evaluate_repl( } }; + line_editor = line_editor.with_buffer_editor(config.buffer_editor.clone(), "nu".into()); + if config.sync_history_on_enter { if is_perf_true { info!("sync history {}:{}:{}", file!(), line!(), column!()); diff --git a/crates/nu-protocol/src/config.rs b/crates/nu-protocol/src/config.rs index 8fcf9eedde..2147d92049 100644 --- a/crates/nu-protocol/src/config.rs +++ b/crates/nu-protocol/src/config.rs @@ -47,6 +47,7 @@ pub struct Config { pub menus: Vec, pub rm_always_trash: bool, pub shell_integration: bool, + pub buffer_editor: String, pub disable_table_indexes: bool, } @@ -74,6 +75,7 @@ impl Default for Config { menus: Vec::new(), rm_always_trash: false, shell_integration: false, + buffer_editor: String::new(), disable_table_indexes: false, } } @@ -256,6 +258,14 @@ impl Value { eprintln!("$config.shell_integration is not a bool") } } + "buffer_editor" => { + if let Ok(v) = value.as_string() { + config.buffer_editor = v.to_lowercase(); + } else { + eprintln!("$config.buffer_editor is not a string") + } + } + "disable_table_indexes" => { if let Ok(b) = value.as_bool() { config.disable_table_indexes = b; diff --git a/docs/sample_config/default_config.nu b/docs/sample_config/default_config.nu index 1a6a4463c9..73bda6f701 100644 --- a/docs/sample_config/default_config.nu +++ b/docs/sample_config/default_config.nu @@ -190,6 +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 ctr+e 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