Skip to content

Commit 99eaf02

Browse files
committed
Typos and wordsmithing
1 parent ccdb6ee commit 99eaf02

File tree

2 files changed

+14
-118
lines changed

2 files changed

+14
-118
lines changed

blog/2024-12-03-configuration_preview.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@ If you have an existing `config.nu` with a complete `$env.config` record, you co
4949
Of course, these users can always simply override that value when and if the default changes.
5050
:::
5151

52-
Note that not _all_ default values are introspectable. The following Nushell internals are no longer set (by default) in `config.nu` and will not be automatically populated:
52+
Not _every_ default value is introspectable. The following Nushell internals are no longer set (by default) in `config.nu` and will not be automatically populated:
5353

5454
- `keybindings`
5555
- `menus`
5656

5757
However, the functionality behind them has always been handled internally by Nushell and Reedline. Only user-defined keybindings and menus should (as best-practice) be specified in the `$env.config`.
5858

59-
### Identifying Overridden Values
59+
### Finding Overridden Values
6060

6161
To identify which values your current configuration has changed from the defaults, run the following in the current build (or 0.101 when available):
6262

@@ -75,12 +75,12 @@ In the above example, `nu` (without a path) needs to point to a 0.101 or higher
7575
Also examine:
7676

7777
- Any theme/styling in `$env.config.color_config` and add those settings if desired.
78-
- Your personalized keybindings in `$env.config.keybindings`. Note that many of the keybindings in the older default configuration files were simply examples that replicated built-in capabilities and did not change any Nushell functionality.
78+
- Your personalized keybindings in `$env.config.keybindings`. Note that most (perhaps all) of the keybindings in the older default configuration files were simply examples that replicated built-in capabilities and did not change any Nushell functionality.
7979
- Any personalized menus in `$env.config.menus`. As with keybindings, you do not need to copy over examples.
8080

8181
### Setting Values in the New Config
8282

83-
Rather than defining a monolithic `$env.config = { ... all values }` as in the past, just create one entry for each setting you wish to **_override_**. For example:
83+
Rather than defining a monolithic **`$env.config = { ... all values }`** as in the past, just create one entry for each setting you wish to **_override_**. For example:
8484

8585
```nu
8686
$env.config.show_banner = false
@@ -90,7 +90,7 @@ $env.history.file_format = "sqlite"
9090
$env.history.max_size: 1_000_000
9191
$env.history.isolation = true
9292
93-
$env.keybindings ++= [{
93+
$env.config.keybindings ++= [{
9494
name: "insert_last_token"
9595
modifier: "alt"
9696
keycode: "char_."

book/configuration_preview.md

Lines changed: 9 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## Quickstart
44

55
While Nushell provides many options for managing its startup and configuration, new users
6-
can get started with several very simple steps:
6+
can get started with just a few simple steps:
77

88
1. Tell Nushell what editor to use:
99

@@ -21,6 +21,13 @@ can get started with several very simple steps:
2121

2222
3. Add commands to this file that should run each time Nushell starts. A good first example might be the `buffer_editor` setting above.
2323

24+
You can find a detailed list of available settings using:
25+
26+
```nu
27+
config nu --sample | nu-highlight | less -R
28+
config env --sample | nu-highlight | less -R
29+
```
30+
2431
4. Save, exit the editor, and start a new Nushell session to load these settings.
2532

2633
That's it! More details are below when you need them ...
@@ -34,7 +41,7 @@ To view a simplified version of this documentation from inside Nushell, run:
3441

3542
```nu
3643
config env --sample | nu-highlight | less -R
37-
config nu -- sample | nu-highlight | less -R
44+
config nu --sample | nu-highlight | less -R
3845
```
3946

4047
:::
@@ -660,114 +667,3 @@ The following stages and their steps _may_ occur during startup, based on the fl
660667
- ❌ Does not read the user's `login.nu` file
661668
- ✅ Runs the `ls` command and exits
662669
- ❌ Does not enter the REPL
663-
664-
## Upgrading to Nushell version 0.101.0 or later
665-
666-
::: note
667-
This is a temporary addendum to the Chapter due to the extensive recent changes in Nushell's startup process. After a few releases with the new configuration features in place, this section will likely be removed.
668-
:::
669-
670-
::: tip In a hurry?
671-
See [Setting Values in the New Config](#setting-values-in-the-new-config) below, then come back and read the rest if needed.
672-
:::
673-
674-
In previous Nushell releases, the recommended practice was to include the **entire** `$env.config` record in `config.nu` and change values within it. Any `$env.config` keys that were not present in this record would use internal defaults, but these settings weren't introspectable in Nushell.
675-
676-
With changes in releases 0.100 and 0.101, (most, but not all) missing values in `$env.config` are automatically populated in the record itself using the default, internal values. With this in place, it's no longer necessary to create a monolithic configuration record.
677-
678-
If you have an existing `config.nu` with a complete `$env.config` record, you could continue to use it, but you should consider streamlining it based on these new features. This has the following advantages:
679-
680-
- Startup will typically be slightly faster.
681-
- It's easier to see exactly which values are overridden, as those should be the only settings changed in `config.nu`.
682-
- If a key name or default value changes in the future, it will only be a breaking change if it was a value that had been overridden. All other values will update seamlessly when you install new Nushell releases.
683-
684-
::: note
685-
This may be an advantage or disadvantage in some situations. For instance, at some point, we plan to switch the default history format to SQLite. When that change occurs in Nushell, it will automatically be changed for all users who hadn't overridden the value. That's a positive change for most users, as they'll automatically be switched to the more advanced format when they upgrade to that (as yet unknown) release, but that change may not be desirable for some users.
686-
687-
Of course, these users can always simply override that value when and if the default changes.
688-
:::
689-
690-
Note that not _all_ default values are introspectable. The following Nushell internals are no longer set (by default) in `config.nu` and will not be automatically populated:
691-
692-
- `keybindings`
693-
- `menus`
694-
695-
Only user-defined keybindings and menus should (as best-practice) be specified in the `$env.config`.
696-
697-
### Identifying Overridden Values
698-
699-
To identify which values your current configuration has changed from the defaults, run the following in the current build (or 0.101 when available):
700-
701-
```nu
702-
let defaults = nu -n -c "$env.config = {}; $env.config | reject color_config keybindings menus | to nuon" | from nuon | transpose key default
703-
let current = $env.config | reject color_config keybindings menus | transpose key current
704-
$current | merge $defaults | where $it.current != $it.default
705-
```
706-
707-
These are the values that you should migrate to your updated `config.nu`.
708-
709-
Also examine:
710-
711-
- Any theme/styling in `$env.config.color_config` and add those settings
712-
- Your personalized keybindings in `$env.config.keybindings`. Note that many of the keybindings in the older default configuration files were examples that replicated built-in capabilities.
713-
- Any personalized menus in `$env.config.menus`. As with keybindings, you do not need to copy over examples.
714-
715-
### Setting Values in the New Config
716-
717-
Rather than defining a `$env.config = { ... all values }` as in the past, just create one entry for each overridden setting. For example:
718-
719-
```nu
720-
$env.config.show_banner = false
721-
$env.config.buffer_editor = "code"
722-
723-
$env.history.file_format = "sqlite"
724-
$env.history.max_size: 1_000_000
725-
$env.history.isolation = true
726-
727-
$env.keybindings ++= [{
728-
name: "insert_last_token"
729-
modifier: "alt"
730-
keycode: "char_."
731-
event: [
732-
{
733-
edit: "InsertString"
734-
value: "!$"
735-
},
736-
{
737-
"send": "Enter"
738-
}
739-
]
740-
mode: [ emacs, vi_normal, vi_insert ]
741-
}]
742-
```
743-
744-
### Other Config Changes in 0.101
745-
746-
- The (previous version) commented sample (default) implementation was useful for learning about configuration options. This documentation has been enhanced and is now available using:
747-
748-
```nu
749-
config env --sample | nu-highlight | less -R
750-
config nu --sample | nu-highlight | less -R
751-
```
752-
753-
- Skeleton config files (`env.nu` and `config.nu`) are automatically created when the default config directory is created. Usually this will be the first time Nushell is started. The user will no longer be asked whether or not to create the files.
754-
755-
- The files that are created have no configuration in them; just comments. This is because, "out-of-the-box", no values are overridden.
756-
757-
- An internal `default_env.nu` is loaded immediately before the user's `env.nu`. You can inspect its
758-
contents using `config env --default | nu-highlight | less -R`.
759-
760-
This means that, as with `config.nu`, you can also use your `env.nu` to just override the default environment variables if desired.
761-
762-
- Likewise, a `default_config.nu` is loaded immediately before the user's `config.nu`. View
763-
this file using `config nu --default | nu-highlight | less -R`.
764-
765-
- `ENV_CONVERSIONS` are run multiple times so that the converted values may be used in `config.nu` and later files. Note that this currently means that `from_string` may be called even when the value is
766-
not a string. The `from_string` closure should check the type and only convert a string.
767-
768-
- The previous `$light_theme` and `$dark_theme` variables have been replaced by new standard library commands:
769-
770-
```nu
771-
use std/config *
772-
$env.config.color_config = (dark-theme)
773-
```

0 commit comments

Comments
 (0)