Nu as a Shell

The Nu Fundamentals and Programming in Nu chapter focused mostly on the language aspects of Nushell. This chapter sheds the light on the parts of Nushell that are related to the Nushell interpreter (the Nushell REPLopen in new window). Some of the concepts are directly a part of the Nushell programming language (such as environment variables) while others are implemented purely to enhance the interactive experience (such as hooks) and thus are not present when, for example, running a script.

Many parameters of Nushell can be configured. The config itself is stored as an environment variable. Furthermore, Nushell has several different configuration files that are run on startup where you can put custom commands, aliases, etc.

A big feature of any shell are environment variables. In Nushell, environment variables are scoped and can have any type supported by Nushell. This brings in some additional design considerations so please refer to the linked section for more details.

The other sections explain how to work with stdout, stderr and exit codes, how to escape a command call to the external command call, and how to configure 3rd party prompts to work with Nushell.

An interesting feature of Nushell is shells which let you work in multiple directories simultaneously.

Nushell also has its own line editor Reedline. With Nushell's config, it is possible to configure some of the Reedline's features, such as the prompt, keybindings, history, or menus.

It is also possible to define custom signatures for external commands which lets you define custom completions for them (the custom completions work also for Nushell custom commands).

Coloring and Theming in Nu goes into more detail about how to configure Nushell's appearance.

If you want to schedule some commands to run in the background, Background task in Nu provide a simple guideline for you to follow.

And finally, hooks allow you to insert fragments of Nushell code to run at certain events.