When saving/reading user-provided syntaxes or themes, `bat` will now maintain a
`metadata.yaml` file which includes information about the `bat` version which was
used to create the cached files. When loading cached files, we now print an error
if they have been created with an incompatible version
closes#882
This adds a `-m`/`--map-syntax` option that allows users to (re)map
certain file extensions or file names to an existing syntax.
For example:
```
bat --map-syntax .config:json
```
The option can be use multiple times. Note that you can easily make
these mappings permanent by using `bat`s new configuration file.
closes#169
This allows users to create simple configuration file
(`~/.config/bat/config` on Linux) that has the following format:
```bash
--flag1
--flag2
--option1=value1
# lines beginning with '#' are ignored
--option2=value2
# empty lines and trailing whitespace are also ignored
--option3=value3
```
- New themes in `$BAT_CONFIG_DIR/themes` are now loaded *in addition* to
the default themes (they may also override).
- The `Default.tmTheme` symlink is not necessary anymore.
This relates to #172
This commit separates the handling of syntax sets and theme sets. It
also changes the way how new syntax definitions are loaded from `bat`'s
configuration folder. New syntax definitions are now loaded *in
addition* to the ones that are stored in the `bat` binary by default.
This fixes#172
The `--theme` command line option stills takes precedence and this
change preserves how errors are handled when it's used: If a theme name
that doesn't exist is specified using the argument, this error is fatal.
However, if a theme that doesn't exist is specified using the environment
variable, the error is logged to `stderr` and the "Default" theme is
loaded as a fallback.
Before this patch:
$ bat cache --init
[bat error]: Could not load themes from '{}'
After:
$ bat cache --init
[bat error]: Could not load themes from '/home/user/.config/bat/themes'
This changes a few things:
- All syntaxes and themes are now stored (as submodules) under
assets/syntaxes and assets/themes
- The default directories for syntaxes and themes are "syntaxes"
and "themes" (used to be "syntax" and "themes")
- The "bat cache" command can now take a `--source <dir>` and
`--target <dir>` option.
- The cached files have been renamed to "themes.bin" and "syntaxes.bin"