@@ -439,6 +439,33 @@ bat cache --build
440Finally, use `bat --list-themes` to check if the new themes are available.
440Finally, use `bat --list-themes` to check if the new themes are available.
442+### Adding or changing file type associations
444+You can add new (or change existing) file name patterns using the `--map-syntax`
445+command line option. The option takes an argument of the form `pattern:syntax` where
446+`pattern` is a glob pattern that is matched against the file name and
447+the absolute file path. The `syntax` part is the full name of a supported language
448+(use `bat --list-languages` for an overview)full .
450+Note: You probably want to use this option as an entry in `bat`s configuration file instead
451+of passing it on the command line (see below).
453+Example: To use "INI" syntax highlighting for all files with a `.conf` file extension, use
455+--map-syntax='*.conf:INI'
458+Example: To open all files called `.ignore` (exact match) with the "Git Ignore" syntax, use:
460+--map-syntax='.ignore:Git Ignore'
463+Example: To open all `.conf` files in subfolders of `/etc/apache2` with the "Apache Conf"
464+syntax, use (this mapping is already built in):
466+-map-syntax='/etc/apache2/**/*.conf:Apache Conf'
442### Using a different pager
469### Using a different pager
444`bat` uses the pager that is specified in the `PAGER` environment variable. If this variable is not
471`bat` uses the pager that is specified in the `PAGER` environment variable. If this variable is not
@@ -490,32 +517,6 @@ and the `GitHub` theme when in the _light mode_.
490alias cat="bat --theme=\$(defaults read -globalDomain AppleInterfaceStyle &> /dev/null && echo default || echo GitHub)"
517alias cat="bat --theme=\$(defaults read -globalDomain AppleInterfaceStyle &> /dev/null && echo default || echo GitHub)"
493−### Adapting file type associations
495−You can add new (or change existing) file name patterns using the
496−`--map-syntax` option. The option takes an argument of the form `pattern:syntax`.
497−`pattern` is a glob pattern that is matched against the file name and
498−the absolute file path. `syntax` is the *name* of a supported language
499−(use `bat --list-languages` for an overview).
501−This option is most useful in combination with the `bat` configuration file (see below).
503−Example: To use "INI" syntax highlighting for all files with a `.conf` file extension, use
505−--map-syntax='*.conf:INI'
508−Example: To open all files called `.ignore` (exact match) with the "Git Ignore" syntax, use:
510−--map-syntax='.ignore:Git Ignore'
513−Example: To open all `.conf` files in subfolders of `/etc/apache2` with the "Apache Conf"
514−syntax, use (this mapping is already built in):
516−-map-syntax='/etc/apache2/**/*.conf:Apache Conf'
520## Configuration file
521## Configuration file