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

@ -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)
# -----------------------
@ -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
@ -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
@ -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
# }
}
# -------------------------------------
@ -914,10 +919,10 @@ const NU_PLUGIN_DIRS = $NU_PLUGIN_DIRS ++ [($nu.default-config-dir | path join '
# Because of the previous ENV_CONVERSIONS (performed internally
# 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,5 +1,7 @@
# 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.

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,5 +1,8 @@
# 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

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.