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/configuration.md
+20-12Lines changed: 20 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,25 +29,33 @@ The default config files aren't required. If you prefer to start with an empty `
29
29
:::
30
30
31
31
Control which directory Nushell reads config files from with the `XDG_CONFIG_HOME` environment variable. When you set it to
32
-
an absolute path, Nushell will read config files from `$"($env.XDG_CONFIG_HOME)/nushell"`.
32
+
an absolute path, Nushell will read config files from `$"($env.XDG_CONFIG_HOME)/nushell"`. For example, if you set it to
33
+
`C:\Users\bob\.config`, Nushell will read config files from `C:\Users\bob\.config\nushell\`.
33
34
34
35
::: warning
35
-
`XDG_CONFIG_HOME` must be set **before** starting Nushell. Do not set it in `env.nu`.
36
+
`XDG_CONFIG_HOME` must be set **before** starting Nushell. Setting it in `env.nu` or `config.nu` won't change where Nushell
37
+
looks for configuration files.
36
38
:::
37
39
38
-
Here's an example for reading config files from `~/.config/nushell` rather than the default directory for Windows, which is `C:\Users\username\AppData\Roaming\nushell`.
40
+
On Windows, you can persistently set the `XDG_CONFIG_HOME` environment variable through the Control Panel. To get there, just
41
+
search for "environment variable" in the Start menu.
On other platforms, if Nushell isn't your login shell, then you can set `XDG_CONFIG_HOME` before launching Nushell. For example, if you
44
+
use MacOS and your login shell is Zsh, you could add the following to your `.zshrc`:
45
+
46
+
```zsh
47
+
export XDG_CONFIG_HOME="/Users/bob/.config"
45
48
```
46
49
50
+
If Nushell is your login shell, then ways to set `XDG_CONFIG_HOME` will depend on your OS.
51
+
Some Linux distros will let you set environment variables in `/etc/profile` or `/etc/profile.d`.
52
+
On modern Linux distros, you can also set it through PAM in `/etc/environment`.
53
+
47
54
::: warning
48
-
[`XDG_CONFIG_HOME`](https://xdgbasedirectoryspecification.com) is not a Nushell-specific environment variable and should not be set to the directory that contains Nushell config files.
49
-
It should be the directory _above_ the `nushell` directory. If you set it to `/Users/username/dotfiles/nushell`, Nushell will look for
50
-
config files in `/Users/username/dotfiles/nushell/nushell` instead. In this case, you would want to set it to `/Users/username/dotfiles`.
55
+
[`XDG_CONFIG_HOME`](https://xdgbasedirectoryspecification.com) is not a Nushell-specific environment variable and should not be set to the
56
+
directory that contains Nushell config files. It should be the directory _above_ the `nushell` directory. If you set it to
57
+
`/Users/username/dotfiles/nushell`, Nushell will look for config files in `/Users/username/dotfiles/nushell/nushell` instead.
58
+
In this case, you would want to set it to `/Users/username/dotfiles`.
51
59
:::
52
60
53
61
## Configuring `$env.config`
@@ -180,7 +188,7 @@ $env.PATH = (
180
188
| append ($env.CARGO_HOME | path join bin)
181
189
| append ($env.HOME | path join .local bin)
182
190
| uniq # filter so the paths are unique
183
-
)
191
+
)
184
192
```
185
193
186
194
This will add `/usr/local/bin`, the `bin` directory of CARGO_HOME, the `.local/bin` of HOME to PATH. It will also remove duplicates from PATH.
0 commit comments