Fix issues in the example configs (#14601)

For some reason, it had multiple syntax errors and other issues, like
undefined options. Would be great to add a test for sourcing all example
configs, but I don't know rust

See also
https://github.com/nushell/nushell/pull/14249#discussion_r1887192408

<!--
if this PR closes one or more issues, you can automatically link the PR
with
them by using one of the [*linking
keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword),
e.g.
- this PR should close #xxxx
- fixes #xxxx

you can also mention related issues, PRs or discussions!
-->

CC @NotTheDr01ds
This commit is contained in:
Perchun Pak 2024-12-17 17:43:25 +01:00 committed by GitHub
parent c266e6adaf
commit cc4da104e0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 72 additions and 56 deletions

View file

@ -3,7 +3,7 @@
#
# version = "0.100.1"
$env.PROMPT_COMMAND = $env.PROMPT_COMMAND? | default {||
$env.PROMPT_COMMAND = $env.PROMPT_COMMAND? | default {||
let dir = match (do -i { $env.PWD | path relative-to $nu.home-path }) {
null => $env.PWD
'' => '~'
@ -17,7 +17,7 @@ $env.PROMPT_COMMAND = $env.PROMPT_COMMAND? | default {||
$path_segment | str replace --all (char path_sep) $"($separator_color)(char path_sep)($path_color)"
}
$env.PROMPT_COMMAND_RIGHT = $env.PROMPT_COMMAND_RIGHT? | default {||
$env.PROMPT_COMMAND_RIGHT = $env.PROMPT_COMMAND_RIGHT? | default {||
# create a right prompt in magenta with green separators and am/pm underlined
let time_segment = ([
(ansi reset)

View file

@ -1,6 +1,9 @@
# Nushell Config File
# Nushell Sample Config File
#
# version = "0.99.2"
# Warning: This file is intended for documentation purposes only and
# is not intended to be used as an actual configuration file as-is.
#
# version = "0.100.1"
#
# A `config.nu` file is used to override default Nushell settings,
# define (or import) custom commands, or run any other startup tasks.
@ -86,14 +89,14 @@ $env.config.recursion_limit = 50
# ---------------------------
# edit_mode (string) "vi" or "emacs" sets the editing behavior of Reedline
edit_mode: "emacs"
$env.config.edit_mode = "emacs"
# Command that will be used to edit the current line buffer with Ctrl+O.
# If unset, uses $env.VISUAL and then $env.EDITOR
#
# Tip: Set to "editor" to use the default editor on Unix platforms using
# the Alternatives system or equivalent
buffer_editor: "editor"
$env.config.buffer_editor = "editor"
# cursor_shape_* (string)
# -----------------------
@ -120,7 +123,7 @@ $env.config.completions.algorithm = "prefix"
$env.config.completions.sort = "smart"
# case_sensitive (bool): true/false to enable/disable case-sensitive completions
$env.config.completions.case_sensitive = false
$env.config.completions.case_sensitive = false
# quick (bool):
# true: auto-select the completion when only one remains
@ -132,7 +135,7 @@ $env.config.completions.quick = true
# false: Do not partially complete
# Partial Example: If a directory contains only files named "forage", "food", and "forest",
# then typing "ls " and pressing <Tab> will partially complete the first two
# letters, "f" and "o". If the directory also includes a file named "faster",
# letters, "f" and "o". If the directory also includes a file named "faster",
# then only "f" would be partially completed.
$env.config.completions.partial = true
@ -145,7 +148,7 @@ $env.config.completions.use_ls_colors = true
# completions.external.*: Settings related to completing external commands
# and additional completers
# external.exnable (bool)
# external.enable (bool)
# true: search for external commands on the Path
# false: disabling might be desired for performance if your path includes
# directories on a slower filesystem
@ -156,16 +159,16 @@ $env.config.completions.external.enable = true
$env.config.completions.external.max_results = 50
# completer (closure with a |spans| parameter): A command to call for *argument* completions
# to commands (internal or external).
# to commands (internal or external).
#
# The |spans| parameter is a list of strings representing the tokens (spans)
# on the current commandline. It is always a list of at least two strings - The
# on the current commandline. It is always a list of at least two strings - The
# command being completed plus the first argument of that command ("" if no argument has
# been partially typed yet), and additional strings for additional arguments beyond
# the first.
#
# This setting is usually set to a closure which will call a third-party completion system, such
# as Carapace.
# as Carapace.
#
# Note: The following is an over-simplified completer command that will call Carapace if it
# is installed. Please use the official Carapace completer, which can be generated automatically
@ -206,8 +209,8 @@ $env.config.shell_integration.osc9_9 = false
# osc8 (bool):
# When true, the `ls` command will generate clickable links that can be launched in another
# application by the terminal.
# Note: This setting replaces the now deprecated `ls.show_clickable_links`
$env.config.shell.integration.osc8: true
# Note: This setting replaces the now deprecated `ls.clickable_links`
$env.config.shell_integration.osc8 = true
# Deprecated
# $env.config.ls.clickable_links = true
@ -229,13 +232,13 @@ $env.config.shell_integration.osc633 = true
# reset_application_mode (bool):
# true/false to enable/disable sending ESC[?1l to the terminal
# This sequence is commonly used to keep cursor key modes in sync between the local
# This sequence is commonly used to keep cursor key modes in sync between the local
# terminal and a remove SSH host.
$env.config.shell_integration.reset_application_mode = true
# bracketed_paste (bool):
# true/false to enable/disable the bracketed-paste feature, which allows multiple-lines
# to be pasted into Nushell at once without immediate execution. When disabled,
# to be pasted into Nushell at once without immediate execution. When disabled,
# each pasted line is executed as it is received.
# Note that bracketed paste is not currently supported on the Windows version of
# Nushell.
@ -266,7 +269,7 @@ $env.config.display_errors.exit_code = false
# display_errors.termination_signal (bool):
# true/false to enable/disable displaying a Nushell error when a child process is
# terminated via any signal
# terminated via any signal
$env.config.display_errors.termination_signal = true
# -------------
@ -282,7 +285,7 @@ $env.config.display_errors.termination_signal = true
$env.config.footer_mode = 25
# table.*
# table_mode (string):
# table_mode (string):
# One of: "default", "basic", "compact", "compact_double", "heavy", "light", "none", "reinforced",
# "rounded", "thin", "with_love", "psql", "markdown", "dots", "restructured", "ascii_rounded",
# or "basic_compact"
@ -344,7 +347,7 @@ $env.config.table.footer_inheritance = false
# Datetime Display
# ----------------
# datetime_format.* (string or nothing):
# Format strings that will be used for datetime values.
# Format strings that will be used for datetime values.
# When set to `null`, the default behavior is to "humanize" the value (e.g., "now" or "a day ago")
# datetime_format.table (string or nothing):
@ -389,7 +392,7 @@ $env.config.float_precision = 2
# ls.use_ls_colors (bool):
# true: The `ls` command will apply the $env.LS_COLORS standard to filenames
# false: Filenames in the `ls` table will use the color_config for strings
$env.config.ls = true
$env.config.ls.use_ls_colors = true
# Hooks
# -----
@ -402,12 +405,19 @@ $env.config.ls = true
# WARNING: A malformed display_output hook can suppress all Nushell output to the terminal.
# It can be reset by assigning an empty string as below:
$env.config.hooks.pre_prompt = [] # Before each prompt is displayed
$env.config.hooks.pre_execution = [] # After <enter> is pressed; before the commandline
# is executed
$env.config.hooks.env_change = [] # When a specified environment variable changes
$env.config.hooks.display_output = "" # Before Nushell output is displayed in the terminal
$env.config.hooks.command_not_found = [] # When a command is not found
# Before each prompt is displayed
$env.config.hooks.pre_prompt = []
# After <enter> is pressed; before the commandline is executed
$env.config.hooks.pre_execution = []
# When a specified environment variable changes
$env.config.hooks.env_change = {
# run if the PWD environment is different since the last repl input
PWD: [{|before, after| null }]
}
# Before Nushell output is displayed in the terminal
$env.config.hooks.display_output = "if (term size).columns >= 100 { table -e } else { table }"
# When a command is not found
$env.config.hooks.command_not_found = []
# -----------
# Keybindings
@ -462,7 +472,7 @@ $env.config.menus ++= [
type: {
layout: description
columns: 4
col_width: 20 # Optional value. If missing all the screen width is used to calculate column width
col_width: 20 # Optional value. If missing all the screen width is used to calculate column width
col_padding: 2
selection_rows: 4
description_rows: 10
@ -480,27 +490,22 @@ $env.config.menus ++= [
# Plugin behavior
# ---------------
# Per-plugin configuration. See https://www.nushell.sh/contributor-book/plugins.html#configuration.
plugins: {}
$env.config.plugins
# Configuration for plugin garbage collection
$env.config.plugin_gc
$env.config.plugin_gc.default
# true to enable stopping of inactive plugins
$env.config.plugin_gc.default.enabled
# How long to wait after a plugin is inactive before stopping it
$env.config.plugin_gc.default.stop_after
$env.config.plugin_gc.plugins
plugin_gc: {
# Configuration for plugin garbage collection
default: {
enabled: true # true to enable stopping of inactive plugins
stop_after: 10sec # how long to wait after a plugin is inactive to stop it
}
plugins: {
# alternate configuration for specific plugins, by name, for example:
#
# gstat: {
# enabled: false
# }
}
}
$env.config.plugin_gc.plugins = {
# Alternate configuration for specific plugins, by name, for example:
#
# gstat: {
# enabled: false
# }
}
# -------------------------------------
@ -532,12 +537,12 @@ use std/config dark-theme
$env.config.color_config = (dark-theme)
# Or, individual color settings can be configured or overridden.
#
#
# Values can be one of:
# - A color name such as "red" (see `ansi -l` for a list)
# - A color RGB value in the form of "#C4C9C6"
# - A record including:
# * `fg` (color)
# * `fg` (color)
# * `bg` (color)
# * `attr`: a string with one or more of:
# - 'n': normal
@ -547,7 +552,7 @@ $env.config.color_config = (dark-theme)
# - 'i': italics
# - 'd': dimmed
# foreground, background, and cursor colors are not handled by Nushell, but can be used by
# foreground, background, and cursor colors are not handled by Nushell, but can be used by
# custom-commands such as `theme` from the nu_scripts repository. That `theme` command can be
# used to set the terminal foreground, background, and cursor colors.
$env.config.color_config.foreground
@ -557,7 +562,7 @@ $env.config.color_config.cursor
# -------------------------------------------------------------------------------------------------
# shape_: Applies syntax highlighting based on the "shape" (inferred or declared type) of an
# element on the commandline. Nushell's parser can identify shapes based on many criteria, often
# as the commandline is being typed.
# as the commandline is being typed.
# shape_string: Can appear as a single-or-quoted value, a bareword string, the key of a record,
# an argument which has been declared as a string, and other parsed strings.
@ -733,7 +738,7 @@ $env.config.color_config.custom # Custom value (often from a plugin)
$env.config.color_config.nothing # Not used, since a null is not displayed
$env.config.color_config.date # datetime value
$env.config.color_config.filesize # filesize value
$env.config.color_config.list # Not currently used. Lists are displayed using their
$env.config.color_config.list # Not currently used. Lists are displayed using their
# members' styles
$env.config.color_config.record # Not currently used. Records are displayed using their
# member's styles
@ -828,7 +833,7 @@ $env.PROMPT_INDICATOR_VI_INSERT = ": "
# When a commandline extends across multiple lines:
$env.PROMPT_MULTILINE_INDICATOR = "::: "
# TRANSIENT_PROMPT_*
# TRANSIENT_PROMPT_*
# ------------------
# Allows a different prompt to be shown after a command has been executed. This
# can be useful if you have a 2-line prompt. Instead of each previously-entered
@ -855,10 +860,10 @@ $env.TRANSIENT_PROMPT_COMMAND_RIGHT = ""
#
# Note: The OS Path variable is automatically converted before env.nu loads, so it can
# be treated a list in this file.
#
#
# Note: Environment variables are not case-sensitive, so the following will work
# for both Windows and Unix-like platforms.
#
#
# By default, the internal conversion looks something like the following, so there
# is no need to add this in your actual env.nu:
$env.ENV_CONVERSIONS = {
@ -912,12 +917,12 @@ const NU_PLUGIN_DIRS = $NU_PLUGIN_DIRS ++ [($nu.default-config-dir | path join '
# Appending to the OS path is a common configuration task.
# Because of the previous ENV_CONVERSIONS (performed internally
# before your config.nu loads), the path variable is a list that can
# before your config.nu loads), the path variable is a list that can
# be appended to using, for example:
$env.path ++= "~/.local/bin"
$env.PATH ++= [ "~/.local/bin" ]
# Or prepend using
$env.path = "~/.local/bin" ++ $env.path
$env.PATH = [ "~/.local/bin" ] ++ $env.PATH
# The `path add` function from the Standard Library also provides
# a convenience method for prepending to the path:

View file

@ -1,9 +1,11 @@
# Sample Nushell Environment Config File
#
# version = "0.100.1"
#
# Previously, environment variables were typically configured in `env.nu`.
# In general, most configuration can and should be performed in `config.nu`
# or one of the autoload directories.
# To pretty-print the in-shell documentation for Nushell's various configuration
# settings, you can run:
config nu --sample | nu-highlight | less -R
config nu --sample | nu-highlight | less -R

View file

@ -1,4 +1,7 @@
# Example Nushell Loginshell Config File
#
# version = "0.100.1"
#
# - has to be as login.nu in the default config directory
# - will be sourced after config.nu and env.nu in case of nushell started as login shell

View file

@ -1,11 +1,14 @@
# config.nu
#
# Installed by:
# version = "0.100.1"
#
# This file is used to override default Nushell settings, define
# (or import) custom commands, or run any other startup tasks.
# See https://www.nushell.sh/book/configuration.html
#
# This file is loaded after env.nu and before login.nu
#
#
# You can open this file in your default editor using:
# config nu
#

View file

@ -1,5 +1,8 @@
# env.nu
#
# Installed by:
# version = "0.100.1"
#
# Previously, environment variables were typically configured in `env.nu`.
# In general, most configuration can and should be performed in `config.nu`
# or one of the autoload directories.