diff --git a/crates/nu-command/src/viewers/explore.rs b/crates/nu-command/src/viewers/explore.rs index 09186d621e..c459bcb254 100644 --- a/crates/nu-command/src/viewers/explore.rs +++ b/crates/nu-command/src/viewers/explore.rs @@ -71,7 +71,7 @@ impl Command for Explore { let config = engine_state.get_config(); let color_hm = get_color_config(config); - let style = theme_from_config(&config.explore_config); + let style = theme_from_config(&config.explore); let view_cfg = ViewConfig::new(config, &color_hm, &style); diff --git a/crates/nu-protocol/src/config.rs b/crates/nu-protocol/src/config.rs index fbf0f36d5d..4278cd2972 100644 --- a/crates/nu-protocol/src/config.rs +++ b/crates/nu-protocol/src/config.rs @@ -87,7 +87,7 @@ pub struct Config { pub show_banner: bool, pub show_clickable_links_in_ls: bool, pub render_right_prompt_on_last_line: bool, - pub explore_config: HashMap, + pub explore: HashMap, } impl Default for Config { @@ -126,7 +126,7 @@ impl Default for Config { show_banner: true, show_clickable_links_in_ls: true, render_right_prompt_on_last_line: false, - explore_config: HashMap::new(), + explore: HashMap::new(), } } } @@ -526,6 +526,13 @@ impl Value { eprintln!("$env.config.{} is not a record", key) } } + "explore" => { + if let Ok(map) = create_map(value, &config) { + config.explore = map; + } else { + eprintln!("$env.config.{} is not a record", key) + } + } // Misc. options "color_config" => { if let Ok(map) = create_map(value, &config) { @@ -813,13 +820,6 @@ impl Value { eprintln!("$env.config.filesize_format is not a string") } } - "explore_config" => { - if let Ok(map) = create_map(value, &config) { - config.explore_config = map; - } else { - eprintln!("$env.config.explore_config is not a map") - } - } // End legacy options x => { eprintln!("$env.config.{} is an unknown config setting", x) diff --git a/crates/nu-utils/src/sample_config/default_config.nu b/crates/nu-utils/src/sample_config/default_config.nu index 8f2cf33748..27deb990b1 100644 --- a/crates/nu-utils/src/sample_config/default_config.nu +++ b/crates/nu-utils/src/sample_config/default_config.nu @@ -262,6 +262,20 @@ let-env config = { truncating_suffix: "..." # A suffix used by the 'truncating' methodology } } + explore: { + highlight: { bg: 'yellow', fg: 'black' } + status_bar: { bg: '#C4C9C6', fg: '#1D1F21' } + command_bar: { fg: '#C4C9C6' } + split_line: '#404040' + cursor: true + # selected_column: 'blue' + # selected_row: { fg: 'yellow', bg: '#C1C2A3' } + # selected_cell: { fg: 'white', bg: '#777777' } + # line_shift: false, + # line_index: false, + # line_head_top: false, + # line_head_bottom: false, + } history: { max_size: 10000 # Session has to be reloaded for this to take effect sync_on_enter: true # Enable to share history between multiple sessions, else you have to close the session to write history to file @@ -293,22 +307,6 @@ let-env config = { show_banner: true # true or false to enable or disable the banner render_right_prompt_on_last_line: false # true or false to enable or disable right prompt to be rendered on last line of the prompt. - # A 'explore' utility config - explore_config: { - highlight: { bg: 'yellow', fg: 'black' } - status_bar: { bg: '#C4C9C6', fg: '#1D1F21' } - command_bar: { fg: '#C4C9C6' } - split_line: '#404040' - cursor: true - # selected_column: 'blue' - # selected_row: { fg: 'yellow', bg: '#C1C2A3' } - # selected_cell: { fg: 'white', bg: '#777777' } - # line_shift: false, - # line_index: false, - # line_head_top: false, - # line_head_bottom: false, - } - hooks: { pre_prompt: [{ $nothing # replace with source code to run before the prompt is shown