Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions book/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ prev:
text: Nu as a Shell
link: /book/nu_as_a_shell.md
---

# Configuration

## Quickstart
Expand Down Expand Up @@ -116,7 +117,7 @@ Other users may prefer a "modular" configuration where each file handles a small
`config.nu` is commonly used to:

- Set [environment variables](#set-environment-variables) for Nushell and other applications
- Set Nushell settings in [`$env.config`](#nushell-settings-in-the-envconfig-record)
- Set Nushell settings in [`$env.config`](#nushell-settings-in-the-env-config-record)
- Load modules or source files so that their commands are readily available
- Run any other applications or commands at startup

Expand Down Expand Up @@ -581,10 +582,10 @@ The following stages and their steps _may_ occur during startup, based on the fl
| 18. | (config files) (plugin) | Processes the signatures in the user's `plugin.msgpackz` (located in the configuration directory) so that added plugins can be used in the following config files. |
| 19. | (config files) | If this is the first time Nushell has been launched, then it creates the configuration directory. "First launch" is determined by whether or not the configuration directory exists. |
| 20. | (config files) | Also, if this is the first time Nushell has been launched, creates a mostly empty (other than a few comments) `env.nu` and `config .nu` in that directory. |
| 21. | (config files) (default_env.nu) | Loads default environment variables from the internal `default_env.nu`. This file can be viewed with: `config env --default \| nu-highlight \| less -R`. |
| 21. | (config files) (default_env.nu) | Loads default environment variables from the internal `default_env.nu`. This file can be viewed with: `config env --default \| nu-highlight \| less -R`. |
| 22. | (config files) (env.nu) | Converts the `PATH` variable into a list so that it can be accessed more easily in the next step. |
| 23. | (config files) (env.nu) | Loads (parses and evaluates) the user's `env.nu` (the path to which was determined above). |
| 24. | (config files) (config.nu) | Loads a minimal `$env.config` record from the internal `default_config.nu`. This file can be viewed with: `config nu --default \| nu-highlight \| less -R`. Most values that are not defined in `default_config.nu` will be auto-populated into `$env.config` using their internal defaults as well. |
| 24. | (config files) (config.nu) | Loads a minimal `$env.config` record from the internal `default_config.nu`. This file can be viewed with: `config nu --default \| nu-highlight \| less -R`. Most values that are not defined in `default_config.nu` will be auto-populated into `$env.config` using their internal defaults as well. |
| 25. | (config files) (config.nu) | Loads (parses and evaluates) the user's `config.nu` (the path to which was determined above). |
| 26. | (config files) (login) | When Nushell is running as a login shell, loads the user's `login.nu`. |
| 27. | (config files) | Loops through the vendor autoload directories and loads any `.nu` files found. The directories are processed in the order found in `$nu.vendor-autoload-dirs`, and files in those directories are processed in alphabetical order. |
Expand Down
5 changes: 3 additions & 2 deletions book/custom_commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ prev:
text: Programming in Nu
link: /book/programming_in_nu.md
---

# Custom Commands

As with any programming language, you'll quickly want to save longer pipelines and expressions so that you can call them again easily when needed.
Expand Down Expand Up @@ -158,7 +159,7 @@ In this case, the final expression is the `match` statement which can return:

- `null` if the directory is empty
- Otherwise, a `record` representing the randomly chosen file
:::
:::

## Custom Commands and Pipelines

Expand Down Expand Up @@ -191,7 +192,7 @@ my-ls | get name
# => ╰───┴───────────────────────╯
```

This lets us easily build custom commands and process their output. Remember that we don't use return statements like other languages. Instead, the [implicit return](#returning-values-from-a-command) allows us to build pipelines that output streams of data that can be connected to other pipelines.
This lets us easily build custom commands and process their output. Remember that we don't use return statements like other languages. Instead, the [implicit return](#returning-values-from-commands) allows us to build pipelines that output streams of data that can be connected to other pipelines.

::: tip Note
The `ls` content is still streamed in this case, even though it is in a separate command. Running this command against a long-directory on a slow (e.g., networked) filesystem would return rows as they became available.
Expand Down
2 changes: 1 addition & 1 deletion book/modules/creating_modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Only definitions marked with `export` (or `export-env` for environment variables
An export cannot have the same name as that of the module itself.
:::

In the [Basic Example](#basic-module-example) above, we had a module named `inc` with a command named `increment`. However, if we rename that file to `increment.nu`, it will fail to import.
In the [Basic Example](#simple-module-example) above, we had a module named `inc` with a command named `increment`. However, if we rename that file to `increment.nu`, it will fail to import.

```nu
mv inc.nu increment.nu
Expand Down