You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: book/coloring_and_theming.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -392,7 +392,7 @@ Coloring of the prompt is controlled by the `block` in `PROMPT_COMMAND` where yo
392
392
393
393
## `LS_COLORS` colors for the `ls` command
394
394
395
-
Nushell will respect and use the `LS_COLORS` environment variable setting on Mac, Linux, and Windows. This setting allows you to define the color of file types when you do a [`ls`](commands/ls.md). For instance, you can make directories one color, _.md markdown files another color, _.toml files yet another color, etc. There are a variety of ways to color your file types.
395
+
Nushell will respect and use the `LS_COLORS` environment variable setting on Mac, Linux, and Windows. This setting allows you to define the color of file types when you do a [`ls`](/commands/docs/ls.md). For instance, you can make directories one color, _.md markdown files another color, _.toml files yet another color, etc. There are a variety of ways to color your file types.
396
396
397
397
There's an exhaustive list [here](https://github.com/trapd00r/LS_COLORS), which is overkill, but gives you an rudimentary understanding of how to create a ls_colors file that `dircolors` can turn into a `LS_COLORS` environment variable.
Copy file name to clipboardExpand all lines: book/configuration.md
+5-5
Original file line number
Diff line number
Diff line change
@@ -34,7 +34,7 @@ By convention, this variable is defined in the `config.nu` file.
34
34
35
35
### Environment
36
36
37
-
You can set environment variables for the duration of a Nushell session using [`let-env`](commands/let-env.html) calls inside the `env.nu` file. For example:
37
+
You can set environment variables for the duration of a Nushell session using [`let-env`](/commands/docs/let-env.html) calls inside the `env.nu` file. For example:
38
38
39
39
```
40
40
let-env FOO = 'BAR'
@@ -77,7 +77,7 @@ You can build the full set of environment variables by running Nu inside of anot
This will print out [`let-env`](commands/let-env.html) lines, one for each environment variable along with its setting.
80
+
This will print out [`let-env`](/commands/docs/let-env.html) lines, one for each environment variable along with its setting.
81
81
82
82
Next, on some distros you'll also need to ensure Nu is in the /etc/shells list:
83
83
@@ -106,7 +106,7 @@ There is an environment variable `$nu.loginshell-path` containing the path to th
106
106
### macOS: Keeping `/usr/bin/open` as `open`
107
107
108
108
Some tools (e.g. Emacs) rely on an `open` command to open files on Mac.
109
-
As Nushell has its own [`open`](commands/open.md) command which has different semantics and shadows `/usr/bin/open`, these tools will error out when trying to use it.
109
+
As Nushell has its own [`open`](/commands/docs/open.md) command which has different semantics and shadows `/usr/bin/open`, these tools will error out when trying to use it.
110
110
One way to work around this is to define a custom command for Nushell's `open` and create an alias for the system's `open` in your `config.nu` file like this:
111
111
112
112
```
@@ -116,13 +116,13 @@ alias open = ^open
116
116
117
117
## PATH configuration
118
118
119
-
In Nushell, [the PATH environment variable](<https://en.wikipedia.org/wiki/PATH_(variable)>) (Path on Windows) is a list of paths. To append a new path to it, you can use [`let-env`](commands/let-env.html) and [`append`](commands/append.html) in `env.nu`:
119
+
In Nushell, [the PATH environment variable](<https://en.wikipedia.org/wiki/PATH_(variable)>) (Path on Windows) is a list of paths. To append a new path to it, you can use [`let-env`](/commands/docs/let-env.html) and [`append`](/commands/docs/append.html) in `env.nu`:
This will append `/some/path` to the end of PATH; you can also use [`prepend`](commands/prepend.html) to add entries to the start of PATH.
125
+
This will append `/some/path` to the end of PATH; you can also use [`prepend`](/commands/docs/prepend.html) to add entries to the start of PATH.
126
126
127
127
Note the `split row (char esep)` step. We need to add it because in `env.nu`, the environment variables inherited from the host process are still strings. The conversion step of environment variables to Nushell values happens after reading the config files (see also the [Environment](environment.html#environment-variable-conversions) section). After that, for example in the Nushell REPL when `PATH`/`Path` is a list , you can use `append`/`prepend` directly.
Copy file name to clipboardExpand all lines: book/environment.md
+10-10
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
A common task in a shell is to control the environment that external applications will use. This is often done automatically, as the environment is packaged up and given to the external application as it launches. Sometimes, though, we want to have more precise control over what environment variables an application sees.
4
4
5
-
You can see the current environment variables using the [`env`](commands/env.html) command:
5
+
You can see the current environment variables using the [`env`](/commands/docs/env.html) command:
6
6
7
7
```
8
8
# name type value raw
@@ -25,7 +25,7 @@ The environment is initially created from the Nu [configuration file](configurat
25
25
26
26
There are several ways to set an environment variable:
27
27
28
-
### [`let-env`](commands/let-env.html)
28
+
### [`let-env`](/commands/docs/let-env.html)
29
29
30
30
Using the `let-env` command is the most straightforward method
Here we've prepended our folder to the existing folders in the Path, so it will have the highest priority.
45
45
If you want to give it the lowest priority instead, you can use the `append` command.
46
46
47
-
### [`load-env`](commands/load-env.html)
47
+
### [`load-env`](/commands/docs/load-env.html)
48
48
49
49
If you have more than one environment variable you'd like to set, you can use `load-env` to create a table of name/value pairs and load multiple variables at the same time:
50
50
@@ -57,7 +57,7 @@ If you have more than one environment variable you'd like to set, you can use `l
57
57
These are defined to be active only temporarily for a duration of executing a code block.
58
58
See [Single-use environment variables](environment.md#single-use-environment-variables) for details.
59
59
60
-
### Calling a command defined with [`def-env`](commands/def-env.md)
60
+
### Calling a command defined with [`def-env`](/commands/docs/def-env.md)
61
61
62
62
See [Defining environment from custom commands](environment.md#defining-environment-from-custom-commands) for details.
63
63
@@ -93,7 +93,7 @@ true
93
93
94
94
## Changing directory
95
95
96
-
Common task in a shell is to change directory with the [`cd`](commands/cd.html) command.
96
+
Common task in a shell is to change directory with the [`cd`](/commands/docs/cd.html) command.
97
97
In Nushell, calling `cd` is equivalent to setting the `PWD` environment variable.
98
98
Therefore, it follows the same rules as other environment variables (for example, scoping).
99
99
@@ -106,14 +106,14 @@ A common shorthand to set an environment variable once is available, inspired by
106
106
BAR
107
107
```
108
108
109
-
You can also use [`with-env`](commands/with-env.html) to do the same thing more explicitly:
109
+
You can also use [`with-env`](/commands/docs/with-env.html) to do the same thing more explicitly:
110
110
111
111
```
112
112
> with-env { FOO: BAR } { $env.FOO }
113
113
BAR
114
114
```
115
115
116
-
The [`with-env`](commands/with-env.html) command will temporarily set the environment variable to the value given (here: the variable "FOO" is given the value "BAR"). Once this is done, the [block](types_of_data.html#blocks) will run with this new environment variable set.
116
+
The [`with-env`](/commands/docs/with-env.html) command will temporarily set the environment variable to the value given (here: the variable "FOO" is given the value "BAR"). Once this is done, the [block](types_of_data.html#blocks) will run with this new environment variable set.
117
117
118
118
## Permanent environment variables
119
119
@@ -129,7 +129,7 @@ let-env FOO = 'BAR'
129
129
## Defining environment from custom commands
130
130
131
131
Due to the scoping rules, any environment variables defined inside a custom command will only exist inside the command's scope.
132
-
However, a command defined as [`def-env`](commands/def-env.html) instead of [`def`](commands/def.html) (it applies also to `export def`, see [Modules](modules.md)) will preserve the environment on the caller's side:
132
+
However, a command defined as [`def-env`](/commands/docs/def-env.html) instead of [`def`](/commands/docs/def.html) (it applies also to `export def`, see [Modules](modules.md)) will preserve the environment on the caller's side:
133
133
134
134
```
135
135
> def-env foo [] {
@@ -192,15 +192,15 @@ Because `nu` is an external program, Nushell translated the `[ a b c ]` list acc
192
192
Running commands with `nu -c` does not load the config file, therefore the env conversion for `FOO` is missing and it is displayed as a plain string -- this way we can verify the translation was successful.
193
193
You can also run this step manually by `do $env.ENV_CONVERSIONS.FOO.to_string [a b c]`
194
194
195
-
If we look back at the [`env`](commands/env.html) command, the `raw` column shows the value translated by `ENV_CONVERSIONS.<name>.to_string` and the `value` column shows the value used in Nushell (the result of `ENV_CONVERSIONS.<name>.from_string` in the case of `FOO`).
195
+
If we look back at the [`env`](/commands/docs/env.html) command, the `raw` column shows the value translated by `ENV_CONVERSIONS.<name>.to_string` and the `value` column shows the value used in Nushell (the result of `ENV_CONVERSIONS.<name>.from_string` in the case of `FOO`).
196
196
If the value is not a string and does not have `to_string` conversion, it is not passed to an external (see the `raw` column of `PROMPT_COMMAND`).
197
197
One exception is `PATH` (`Path` on Windows): by default, it converts the string to a list on startup and from a list to a string when running externals if no manual conversions are specified.
198
198
199
199
_(Important! The environment conversion string -> value happens **after** the env.nu and config.nu are evaluated. All environment variables in env.nu and config.nu are still strings unless you set them manually to some other values.)_
200
200
201
201
## Removing environment variables
202
202
203
-
You can remove an environment variable only if it was set in the current scope via [`hide-env`](commands/hide_env.html):
203
+
You can remove an environment variable only if it was set in the current scope via [`hide-env`](/commands/docs/hide_env.html):
Copy file name to clipboardExpand all lines: book/escaping.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Escaping to the system
2
2
3
-
Nu provides a set of commands that you can use across different OSes ("internal" commands), and having this consistency is helpful. Sometimes, though, you want to run an external command that has the same name as an internal Nu command. To run the external `ls` or `date` command, for example, you use the caret (^) command. Escaping with the caret prefix calls the command that's in the user's PATH (e.g. `/bin/ls` instead of Nu's internal [`ls`](commands/ls.md) command).
3
+
Nu provides a set of commands that you can use across different OSes ("internal" commands), and having this consistency is helpful. Sometimes, though, you want to run an external command that has the same name as an internal Nu command. To run the external `ls` or `date` command, for example, you use the caret (^) command. Escaping with the caret prefix calls the command that's in the user's PATH (e.g. `/bin/ls` instead of Nu's internal [`ls`](/commands/docs/ls.md) command).
0 commit comments