reorder config.rs to match structure in default_config.nu

This commit is contained in:
amtoine 2023-07-13 18:02:53 +02:00
parent 9a6a3a731e
commit 3e2bfc9bb7
No known key found for this signature in database
GPG key ID: 37AAE9B486CFF1AB
2 changed files with 77 additions and 70 deletions

View file

@ -113,47 +113,61 @@ pub struct Config {
impl Default for Config { impl Default for Config {
fn default() -> Config { fn default() -> Config {
Config { Config {
filesize_metric: false, show_banner: true,
table_mode: "rounded".into(),
table_show_empty: true,
external_completer: None,
use_ls_colors: true, use_ls_colors: true,
color_config: HashMap::new(), show_clickable_links_in_ls: true,
use_grid_icons: false,
footer_mode: FooterMode::RowCount(25), rm_always_trash: false,
float_precision: 4,
max_external_completion_results: 100, cd_with_abbreviations: false,
filesize_format: "auto".into(),
use_ansi_coloring: true, table_mode: "rounded".into(),
quick_completions: true, table_index_mode: TableIndexMode::Always,
partial_completions: true, table_show_empty: true,
completion_algorithm: "prefix".into(), trim_strategy: TRIM_STRATEGY_DEFAULT,
edit_mode: "emacs".into(),
datetime_normal_format: None,
datetime_table_format: None,
explore: HashMap::new(),
max_history_size: i64::MAX, max_history_size: i64::MAX,
sync_history_on_enter: true, sync_history_on_enter: true,
history_file_format: HistoryFileFormat::PlainText, history_file_format: HistoryFileFormat::PlainText,
history_isolation: false, 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, case_sensitive_completions: false,
quick_completions: true,
partial_completions: true,
completion_algorithm: "prefix".into(),
enable_external_completion: true, enable_external_completion: true,
trim_strategy: TRIM_STRATEGY_DEFAULT, max_external_completion_results: 100,
show_banner: true, external_completer: None,
bracketed_paste: true,
show_clickable_links_in_ls: true, filesize_metric: false,
render_right_prompt_on_last_line: false, filesize_format: "auto".into(),
explore: HashMap::new(),
cursor_shape_emacs: NuCursorShape::Line,
cursor_shape_vi_insert: NuCursorShape::Block, cursor_shape_vi_insert: NuCursorShape::Block,
cursor_shape_vi_normal: NuCursorShape::UnderScore, cursor_shape_vi_normal: NuCursorShape::UnderScore,
cursor_shape_emacs: NuCursorShape::Line,
datetime_normal_format: None, color_config: HashMap::new(),
datetime_table_format: None, 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(),
} }
} }
} }

View file

@ -184,18 +184,21 @@ let light_theme = {
# The default config record. This is where much of your global configuration is setup. # The default config record. This is where much of your global configuration is setup.
$env.config = { $env.config = {
# true or false to enable or disable the welcome banner at startup show_banner: true # true or false to enable or disable the welcome banner at startup
show_banner: true
ls: { ls: {
use_ls_colors: true # use the LS_COLORS environment variable to colorize output 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. clickable_links: true # enable or disable clickable links. Your terminal has to support links.
} }
rm: { rm: {
always_trash: false # always act as if -t was given. Can be overridden with -p always_trash: false # always act as if -t was given. Can be overridden with -p
} }
cd: { cd: {
abbreviations: false # allows `cd s/o/f` to expand to `cd some/other/folder` abbreviations: false # allows `cd s/o/f` to expand to `cd some/other/folder`
} }
table: { table: {
mode: rounded # basic, compact, compact_double, light, thin, with_love, rounded, reinforced, heavy, none, other 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 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. # 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, # Behavior without this configuration point will be to "humanize" the datetime display,
# showing something like "a day ago." # showing something like "a day ago."
datetime_format: { datetime_format: {
normal: '%a, %d %b %Y %H:%M:%S %z' # shows up in displays of variables or other datetime's outside of tables 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: { explore: {
help_banner: true help_banner: true
exit_esc: true exit_esc: true
command_bar_text: '#C4C9C6' 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_background: {fg: '#1D1F21' bg: '#C4C9C6' }
# status_bar_text: {fg: '#C4C9C6' bg: '#223311' } status_bar_text: {fg: '#C4C9C6' bg: '#223311' }
highlight: {bg: 'yellow' fg: 'black' } highlight: {bg: 'yellow' fg: 'black' }
status: { status: {
# warn: {bg: 'yellow', fg: 'blue'} warn: {bg: 'yellow', fg: 'blue'}
# error: {bg: 'yellow', fg: 'blue'} error: {bg: 'yellow', fg: 'blue'}
# info: {bg: 'yellow', fg: 'blue'} info: {bg: 'yellow', fg: 'blue'}
} }
try: { try: {
# border_color: 'red' border_color: 'red'
# highlighted_color: 'blue' highlighted_color: 'blue'
reactive: false
# reactive: false
} }
table: { table: {
split_line: '#404040' split_line: '#404040'
cursor: true cursor: true
line_index: true line_index: true
line_shift: true line_shift: true
line_head_top: true line_head_top: true
line_head_bottom: true line_head_bottom: true
show_head: true show_head: true
show_index: true show_index: true
selected_cell: {fg: 'white', bg: '#777777'}
# selected_cell: {fg: 'white', bg: '#777777'} selected_row: {fg: 'yellow', bg: '#C1C2A3'}
# selected_row: {fg: 'yellow', bg: '#C1C2A3'} selected_column: blue
# selected_column: blue padding_column_right: 2
padding_column_left: 2
# padding_column_right: 2 padding_index_left: 2
# padding_column_left: 2 padding_index_right: 1
# padding_index_left: 2
# padding_index_right: 1
} }
config: { config: {
cursor_color: {bg: 'yellow' fg: 'black' } cursor_color: {bg: 'yellow' fg: 'black' }
border_color: white
# border_color: white list_color: green
# list_color: green
} }
} }
@ -279,6 +266,7 @@ $env.config = {
file_format: "plaintext" # "sqlite" or "plaintext" 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. 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: { completions: {
case_sensitive: false # set to true to enable case-sensitive 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 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 completer: null # check 'carapace_completer' above as an example
} }
} }
filesize: { filesize: {
metric: true # true => KB, MB, GB (ISO standard), false => KiB, MiB, GiB (Windows standard) 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 format: "auto" # b, kb, kib, mb, mib, gb, gib, tb, tib, pb, pib, eb, eib, auto
} }
cursor_shape: { cursor_shape: {
emacs: line # block, underscore, line, blink_block, blink_underscore, blink_line (line is the default) 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_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) 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 use_grid_icons: true
footer_mode: "25" # always, never, number_of_rows, auto footer_mode: "25" # always, never, number_of_rows, auto
float_precision: 2 # the precision for displaying floats in tables 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 use_ansi_coloring: true
bracketed_paste: true # enable bracketed paste, currently useless on windows bracketed_paste: true # enable bracketed paste, currently useless on windows
edit_mode: emacs # emacs, vi 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 null # replace with source code to return an error message when a command is not found
} }
} }
menus: [ menus: [
# Configuration for default nushell menus # Configuration for default nushell menus
# Note the lack of source parameter # Note the lack of source parameter
@ -448,6 +440,7 @@ $env.config = {
} }
} }
] ]
keybindings: [ keybindings: [
{ {
name: completion_menu name: completion_menu