add examples for adding paths to PATH, and to load from a custom file in default_env.nu (#12032)

# Description
Show an example of loading from a custom file, and an example of adding
multiple entry to PATH. Loading from a custom file will hopefully allow
for greater modularity of configuration files out of the box for new
users. Adding multiple paths to PATH is very common, and will help new
users to.

Adds this:
```
# To add multiple paths to PATH this may be simpler:
# use std "path add"
# $env.PATH = ($env.PATH | split row (char esep))
# path add /some/path
# path add ($env.CARGO_HOME | path join "bin")
# path add ($env.HOME | path join ".local" "bin")
# $env.PATH = ($env.PATH | uniq)

# To load from a custom file you can use:
# source ($nu.default-config-dir | path join 'custom.nu')
```

---------

Co-authored-by: Darren Schroeder <343840+fdncred@users.noreply.github.com>
This commit is contained in:
Jordan Stewart 2024-03-03 04:14:42 +11:00 committed by GitHub
parent 626d597527
commit 9a9fdd7a35
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -87,3 +87,14 @@ $env.NU_PLUGIN_DIRS = [
# To add entries to PATH (on Windows you might use Path), you can use the following pattern: # To add entries to PATH (on Windows you might use Path), you can use the following pattern:
# $env.PATH = ($env.PATH | split row (char esep) | prepend '/some/path') # $env.PATH = ($env.PATH | split row (char esep) | prepend '/some/path')
# An alternate way to add entries to $env.PATH is to use the custom command `path add`
# which is built into the nushell stdlib:
# use std "path add"
# $env.PATH = ($env.PATH | split row (char esep))
# path add /some/path
# path add ($env.CARGO_HOME | path join "bin")
# path add ($env.HOME | path join ".local" "bin")
# $env.PATH = ($env.PATH | uniq)
# To load from a custom file you can use:
# source ($nu.default-config-dir | path join 'custom.nu')