From 9a9fdd7a35de0ad542311852708b918ba013132a Mon Sep 17 00:00:00 2001 From: Jordan Stewart Date: Sun, 3 Mar 2024 04:14:42 +1100 Subject: [PATCH] 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> --- crates/nu-utils/src/sample_config/default_env.nu | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/crates/nu-utils/src/sample_config/default_env.nu b/crates/nu-utils/src/sample_config/default_env.nu index 8dec580f1b..ad1877219d 100644 --- a/crates/nu-utils/src/sample_config/default_env.nu +++ b/crates/nu-utils/src/sample_config/default_env.nu @@ -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: # $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')