# More Config Ideas ## Prerequisites ### `use` directories as modules ### `const` (exists already) ### Module constants (maybe also full variables) ``` # spam.nu const foo = 'foo' export const foos = [ $foo $foo $foo ] let bar = 'bar' export let bars = [ $bar $bar $bar ] ``` ``` > use spam.nu > $spam | table -e foos 0 foo 1 foo 2 foo bars 0 bar 1 bar 2 bar ``` ### const eval of subexpressions ### `env from-strings` New `env` subcommand to convert env strings into values. Handles Path/PATH conversion automatically if not defined in `$env.ENV_CONVERSIONS`. Can be coded in Nu language as a part of stdlib eventually. ## The Config ``` # ~/.nushell/config.nu # today's env.nu + config.nu witout completions merged together # read-only, could be hardcoded in memory source default_config.nu # could be part of default config: load-env { env from-strings } use std # maybe start working on stdlib and ship it with the default config? # The bellow code handles updates to the default config from user files const NU_LIB_DIRS = ($NU_LIB_DIRS | append # your custom directories ]) const NU_PLUGIN_DIRS = ($NU_PLUGIN_DIRS | append [ # your custom directories ]) # no need for a user to edit this: let-env config = do { use config let hooks = ($config | get -i keybindings | default {}) let keybindings = ($config | get -i keybindings | default {}) # we can have a helper command in default config to handle these in a more robust way (e.g. deal with duplicates etc.) $env.config.hooks = ($env.config.hooks | append $hooks) $env.config.keybindings = ($env.config.keybindings | append $keybindings) # etc... } use completions/* # Put your own code below: ```