sync default config / env with default behaviour without any configuration (#9676)

related PRs and issues
- supersedes https://github.com/nushell/nushell/pull/9633
- should close https://github.com/nushell/nushell/issues/9630

# Description
this PR updates the `default_config.nu` config file and the `config.rs`
module in `nu_protocol` so that the default behaviour of Nushell,
without any config, and the one with `default_config.nu` and
`default_env.nu` are the same.

## changelog
- 3e2bfc9bb: copy the structure of `default_config.nu` inside the
implementation of `Default` in the `config.rs` module for easier check
of the default values
- e25e5ccd6: sync all the *simple* config fields, i.e. the
non-structured ones
- ae7e8111c: set the `display_output` hook to always run `table`
- a09a1c564: leave only the default menus => i've removed
`commands_menu`, `vars_menu` and `commands_with_description`

## todo
- [x] ~~check the defaults in `$env.config.explore`~~ done in 173bdbba5
and b9622084c
- [x] ~~check the defaults in `$env.config.color_config`~~ done in
c411d781d => the theme is now `{}` by default so that it's the same as
the default one with `--no-config`
- [x] ~~check the defaults `$env.config.keybindings`~~ done in 715a69797
- already available with the selected mode: `completion_previous`,
`next_page`, `undo_or_previous_page`, `yank`, `unix-line-discard` and
`kill-line`, e.g. in *vi* mode, `unlix-line-discard` is done in NORMAL
mode with either `d0` from the end of the line or `dd` from anywhere in
the line and `kill-line` is done in NORMAL mode with `shift + d`. these
bindings are available by default in *emacs* mode as well.
- previously with removed custom menus: `commands_menu`, `vars_menu` and
`commands_with_description`
- [x] ~~check `$env.config.datetime_format`~~ done in 0ced6b8ec => as
there is no *human* format for datetimes, i've commented out both
`$env.config.datetime_format` fields
- [x] ~~fix `default_env.nu`~~ done in 67c215011

# User-Facing Changes
this should not change anything, just make sure the default behaviour of
Nushell and the `default_config.nu` are in sync.

# Tests + Formatting
# After Submitting
This commit is contained in:
Antoine Stevan
2023-07-18 18:22:00 +02:00
committed by GitHub
parent cc202e2199
commit 345c00aa1e
4 changed files with 496 additions and 223 deletions

View File

@ -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,
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: 100_000,
sync_history_on_enter: true,
history_file_format: HistoryFileFormat::PlainText,
history_isolation: true,
case_sensitive_completions: false,
quick_completions: true,
partial_completions: true,
completion_algorithm: "prefix".into(),
edit_mode: "emacs".into(),
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,
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: true,
footer_mode: FooterMode::RowCount(25),
float_precision: 2,
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(),
}
}
}