From 3e2bfc9bb70717677c8d7e60386fea776fcea572 Mon Sep 17 00:00:00 2001 From: amtoine Date: Thu, 13 Jul 2023 18:02:53 +0200 Subject: [PATCH] reorder `config.rs` to match structure in `default_config.nu` --- crates/nu-protocol/src/config.rs | 78 +++++++++++-------- .../src/sample_config/default_config.nu | 69 ++++++++-------- 2 files changed, 77 insertions(+), 70 deletions(-) diff --git a/crates/nu-protocol/src/config.rs b/crates/nu-protocol/src/config.rs index 0d97178020..db1cce33ce 100644 --- a/crates/nu-protocol/src/config.rs +++ b/crates/nu-protocol/src/config.rs @@ -113,47 +113,61 @@ pub struct Config { impl Default for Config { fn default() -> Config { Config { - filesize_metric: false, - table_mode: "rounded".into(), - table_show_empty: true, - external_completer: None, + show_banner: true, + use_ls_colors: true, - color_config: HashMap::new(), - use_grid_icons: false, - footer_mode: FooterMode::RowCount(25), - float_precision: 4, - max_external_completion_results: 100, - filesize_format: "auto".into(), - use_ansi_coloring: true, - quick_completions: true, - partial_completions: true, - completion_algorithm: "prefix".into(), - edit_mode: "emacs".into(), + show_clickable_links_in_ls: true, + + rm_always_trash: false, + + cd_with_abbreviations: false, + + table_mode: "rounded".into(), + table_index_mode: TableIndexMode::Always, + table_show_empty: true, + trim_strategy: TRIM_STRATEGY_DEFAULT, + + datetime_normal_format: None, + datetime_table_format: None, + + explore: HashMap::new(), + max_history_size: i64::MAX, sync_history_on_enter: true, history_file_format: HistoryFileFormat::PlainText, history_isolation: false, - keybindings: Vec::new(), - menus: Vec::new(), - hooks: Hooks::new(), - rm_always_trash: false, - shell_integration: false, - buffer_editor: String::new(), - table_index_mode: TableIndexMode::Always, - cd_with_abbreviations: false, + case_sensitive_completions: false, + quick_completions: true, + partial_completions: true, + completion_algorithm: "prefix".into(), enable_external_completion: true, - trim_strategy: TRIM_STRATEGY_DEFAULT, - show_banner: true, - bracketed_paste: true, - show_clickable_links_in_ls: true, - render_right_prompt_on_last_line: false, - explore: HashMap::new(), + max_external_completion_results: 100, + external_completer: None, + + filesize_metric: false, + filesize_format: "auto".into(), + + cursor_shape_emacs: NuCursorShape::Line, cursor_shape_vi_insert: NuCursorShape::Block, cursor_shape_vi_normal: NuCursorShape::UnderScore, - cursor_shape_emacs: NuCursorShape::Line, - datetime_normal_format: None, - datetime_table_format: None, + + color_config: HashMap::new(), + use_grid_icons: false, + footer_mode: FooterMode::RowCount(25), + float_precision: 4, + buffer_editor: String::new(), + use_ansi_coloring: true, + bracketed_paste: true, + edit_mode: "emacs".into(), + shell_integration: false, + render_right_prompt_on_last_line: false, + + hooks: Hooks::new(), + + menus: Vec::new(), + + keybindings: Vec::new(), } } } diff --git a/crates/nu-utils/src/sample_config/default_config.nu b/crates/nu-utils/src/sample_config/default_config.nu index 798b969851..dba55dfe3b 100644 --- a/crates/nu-utils/src/sample_config/default_config.nu +++ b/crates/nu-utils/src/sample_config/default_config.nu @@ -184,18 +184,21 @@ let light_theme = { # The default config record. This is where much of your global configuration is setup. $env.config = { - # true or false to enable or disable the welcome banner at startup - show_banner: true + show_banner: true # true or false to enable or disable the welcome banner at startup + ls: { use_ls_colors: true # use the LS_COLORS environment variable to colorize output clickable_links: true # enable or disable clickable links. Your terminal has to support links. } + rm: { always_trash: false # always act as if -t was given. Can be overridden with -p } + cd: { abbreviations: false # allows `cd s/o/f` to expand to `cd some/other/folder` } + table: { mode: rounded # basic, compact, compact_double, light, thin, with_love, rounded, reinforced, heavy, none, other index_mode: always # "always" show indexes, "never" show indexes, "auto" = show indexes when a table has "index" column @@ -210,66 +213,50 @@ $env.config = { # datetime_format determines what a datetime rendered in the shell would look like. # Behavior without this configuration point will be to "humanize" the datetime display, # showing something like "a day ago." - datetime_format: { normal: '%a, %d %b %Y %H:%M:%S %z' # shows up in displays of variables or other datetime's outside of tables - # table: '%m/%d/%y %I:%M:%S%p' # generally shows up in tabular outputs such as ls. commenting this out will change it to the default human readable datetime format + table: '%m/%d/%y %I:%M:%S%p' # generally shows up in tabular outputs such as ls. commenting this out will change it to the default human readable datetime format } explore: { help_banner: true exit_esc: true - command_bar_text: '#C4C9C6' - # command_bar: {fg: '#C4C9C6' bg: '#223311' } - + command_bar: {fg: '#C4C9C6' bg: '#223311' } status_bar_background: {fg: '#1D1F21' bg: '#C4C9C6' } - # status_bar_text: {fg: '#C4C9C6' bg: '#223311' } - + status_bar_text: {fg: '#C4C9C6' bg: '#223311' } highlight: {bg: 'yellow' fg: 'black' } - status: { - # warn: {bg: 'yellow', fg: 'blue'} - # error: {bg: 'yellow', fg: 'blue'} - # info: {bg: 'yellow', fg: 'blue'} + warn: {bg: 'yellow', fg: 'blue'} + error: {bg: 'yellow', fg: 'blue'} + info: {bg: 'yellow', fg: 'blue'} } - try: { - # border_color: 'red' - # highlighted_color: 'blue' - - # reactive: false + border_color: 'red' + highlighted_color: 'blue' + reactive: false } - table: { split_line: '#404040' - cursor: true - line_index: true line_shift: true line_head_top: true line_head_bottom: true - show_head: true show_index: true - - # selected_cell: {fg: 'white', bg: '#777777'} - # selected_row: {fg: 'yellow', bg: '#C1C2A3'} - # selected_column: blue - - # padding_column_right: 2 - # padding_column_left: 2 - - # padding_index_left: 2 - # padding_index_right: 1 + selected_cell: {fg: 'white', bg: '#777777'} + selected_row: {fg: 'yellow', bg: '#C1C2A3'} + selected_column: blue + padding_column_right: 2 + padding_column_left: 2 + padding_index_left: 2 + padding_index_right: 1 } - config: { cursor_color: {bg: 'yellow' fg: 'black' } - - # border_color: white - # list_color: green + border_color: white + list_color: green } } @@ -279,6 +266,7 @@ $env.config = { file_format: "plaintext" # "sqlite" or "plaintext" isolation: true # true enables history isolation, false disables it. true will allow the history to be isolated to the current session. false will allow the history to be shared across all sessions. } + completions: { case_sensitive: false # set to true to enable case-sensitive completions quick: true # set this to false to prevent auto-selecting completions when only one remains @@ -290,20 +278,23 @@ $env.config = { completer: null # check 'carapace_completer' above as an example } } + filesize: { metric: true # true => KB, MB, GB (ISO standard), false => KiB, MiB, GiB (Windows standard) format: "auto" # b, kb, kib, mb, mib, gb, gib, tb, tib, pb, pib, eb, eib, auto } + cursor_shape: { emacs: line # block, underscore, line, blink_block, blink_underscore, blink_line (line is the default) vi_insert: block # block, underscore, line , blink_block, blink_underscore, blink_line (block is the default) vi_normal: underscore # block, underscore, line, blink_block, blink_underscore, blink_line (underscore is the default) } - color_config: $dark_theme # if you want a light theme, replace `$dark_theme` to `$light_theme` + + color_config: $dark_theme # if you want a light theme, replace `$dark_theme` to `$light_theme` use_grid_icons: true footer_mode: "25" # always, never, number_of_rows, auto float_precision: 2 # the precision for displaying floats in tables - # 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 + 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 bracketed_paste: true # enable bracketed paste, currently useless on windows edit_mode: emacs # emacs, vi @@ -329,6 +320,7 @@ $env.config = { null # replace with source code to return an error message when a command is not found } } + menus: [ # Configuration for default nushell menus # Note the lack of source parameter @@ -448,6 +440,7 @@ $env.config = { } } ] + keybindings: [ { name: completion_menu