This is from Nushell 0.110.0 $nu The $nu constant is a record containing several useful values:
- default-config-dir: The directory where the configuration files are stored and read.
- config-path: The path of the main Nushell config file, normally config.nu in the config directory.
- env-path: The optional environment config file, normally env.nu in the config directory.
- history-path: The text or SQLite file storing the command history.
- loginshell-path: The optional config file which runs for login shells, normally login.nu in the config directory.
- plugin-path: The plugin registry file, normally plugin.msgpackz in the config directory.
- home-dir: The user's home directory which can be accessed using the shorthand ~.
- data-dir: The data directory for Nushell, which includes the ./vendor/autoload directories loaded at startup and other user data.
- cache-dir: A directory for non-essential (cached) data.
- vendor-autoload-dirs: A list of directories where third-party applications should install configuration files that will be auto-loaded during startup.
- user-autoload-dirs: A list of directories where the user may create additional configuration files which will be auto-loaded during startup.
- temp-dir: A path for temporary files that should be writeable by the user.
- pid: The PID of the currently running Nushell process.
- os-info: Information about the host operating system.
- startup-time: The amount of time (in duration) that it took for Nushell to start and process all configuration files.
- is-interactive: A boolean indicating whether Nushell was started as an interactive shell (true) or is running a script or command-string. For example:
- is-login: Indicates whether or not Nushell was started as a login shell.
- history-enabled: History may be disabled via nu --no-history, in which case this constant will be false.
- current-exe: The full path to the currently-running nu binary. Can be combined with path dirname (which is constant) to determine the directory where the binary is located.
- Note a folder listed may no exist.
$nu.vendor-autoload-dirs
| par-each { |dir|
{
directory: ($dir | path expand),
exists: ($dir | path exists),
files: (
try {
ls -a $dir | get name | path basename
} catch {
[]
}
)
}
}╭───┬───────────────────────────────────────────────────────────┬────────┬───────────────────────────╮
│ # │ directory │ exists │ files │
├───┼───────────────────────────────────────────────────────────┼────────┼───────────────────────────┤
│ 0 │ C:\ProgramData\nushell\vendor\autoload │ false │ [list 0 items] │
│ 1 │ C:\Users\Paul_Ray\AppData\Roaming\nushell\vendor\autoload │ true │ ╭───┬───────────────────╮ │
│ │ │ │ │ 0 │ 20251010_1953.zip │ │
│ │ │ │ │ 1 │ 20251020_1359.zip │ │
│ │ │ │ │ 2 │ oh-my-posh.nu │ │
│ │ │ │ │ 3 │ versions │ │
│ │ │ │ ╰───┴───────────────────╯ │
╰───┴───────────────────────────────────────────────────────────┴────────┴───────────────────────────╯