diff --git a/cookbook/setup.md b/cookbook/setup.md index 35e3fc14a76..5fd35400d82 100644 --- a/cookbook/setup.md +++ b/cookbook/setup.md @@ -11,15 +11,35 @@ There are other ways to view these values and variables, however setting up your ### Configure your path and other environment variables -In order to configure your path in nushell you'll need to modify your `PATH` environment variable in your `config.nu` file. Open your `config.nu` file and put an entry in it like `$env.PATH = "path1;path2;path3"` ensuring that you use the proper path separation character, which is different by platform. +In your `env.nu`, you can set up your environment. -Alternately, if you want to append a folder to your `PATH` environment variable you can do that too using the `append` or `prepend` command like this: +To configure environment variables, you use the `$env` variable: ```nu -$env.PATH = ($env.PATH | split row (char esep) | append "some/other/path") +$env.TITLE = 'Nu Test' +$env.VALUE = 123 ``` -For more detailed instructions, see the documentation about [environment variables](/book/environment.html#setting-environment-variables) and [PATH configuration](/book/configuration.html#path-configuration). +To add paths to the `PATH` environment variable, you can append them: + +```nu +$env.PATH ++= ['~/.local/bin'] +``` + +Because you can append a list of paths, you can append multiple at once. You can also use subcommands to construct the paths in line. + +```nu +$env.PATH ++= [ '~/.local/bin', ($env.CARGO_HOME | path join "bin") ] +``` + +Because PATH order makes a difference, you may want to *prepend* your paths instead, so that they take precedence over other executables with the same name: + +``` +use std/util "path add" +path add '~/.local/bin' +``` + +For more information, see the documentation about [environment variables](/book/environment.html#setting-environment-variables) and [PATH configuration](/book/configuration.html#path-configuration). ### How to list your environment variables