By default, Numbat will load the following modules/files during startup, in order:
- Numbat Prelude (a module called
prelude, either from
<module-path>/prelude.nbtif available, or the builtin version)
- The user initialization file, if available (a file called
Numbat’s configuration folder (
<config-path> above) can be found under:
Numbat will load modules from the following sources. Entries higher up in the list take precedence.
|This environment variable can point to a|
single directory or contain a
list of paths
|User-customized module folder|
|System-wide module folder (Linux and macOS)|
|System-wide module folder (Windows)|
|Builtin modules inside the |
Note that the System-location might be different for some installation methods. Refer to your package manager for details.
Numbat’s configuration file is called
config.toml, and it needs to be placed in
<config-path> described above (
~/.config/numbat/config.toml on Linux). You
can generate a default configuration by calling
The most important fields are:
# Controls the welcome message. Can be "long", "short", or "off". intro-banner = "long" # Controls the prompt character(s) in the interactive terminal. prompt = ">>> " # Whether or not to pretty-print expressions before showing the result. # Can be "always", "never" or "auto". The latter uses pretty-printing # only in interactive mode. pretty-print = "auto" [exchange-rates] # When and if to load exchange rates from the European Central Bank for # currency conversions. Can be "on-startup" to always fetch exchange rates # in the background when the application is started. With "on-first-use", # Numbat only fetches exchange rates when they are needed. Exchange rate # fetching can also be disabled using "never". The latter will lead to # "unknown identifier" errors when a currency unit is being used. fetching-policy = "on-startup"
If you want to add custom functions, constants, or units to your default environment,
init.nbt file in your config folder (
~/.config/numbat/init.nbt on Linux).
You can also create your own modules that can be loaded on demand. To this end,
create a new file, say
<module-path>/user/finance.nbt in one of the module folders
~/.config/numbat/modules/custom/finance.nbt on Linux). This module can then be
in your Numbat scripts or in the REPL. You can also load custom modules from
if you want to have them available all the time.
You can also organize modules into subfolders (e.g.
In that case, you can load them using
In fact, the
custom folder is just a convention to avoid name clashes with the