I would like to add custom file name and extension mappings to a language. For example, Erlang often uses .config as an extension for configuration files, and some canonical files like rebar.lock in the project root folder should also be highlighted as Erlang.
It would be nice to be able to assign custom extension mappings to languages, and additionally complete file name mappings (could also be abused as extensions).
The file extensions and filenames that should be highlighted are specified in the respective sublime-syntax files. See the one for Erlang, for example. If something like rebar.lock is common for Erlang projects (and not used by other languages), it could probably be added in sublimehq/Packages.
However, they will probably not accept something generic like .config. One option that should work already is to use bat's customization features, which would allow you to modify the Erlang.sublime-syntax file for yourself. It's not a super-convenient way, though.
I'm inclined to say that this feature would be a useful addition to bat. However, we would first need to figure out a way to add a configuration file. We would probably put a YAML/JSON file somewhere in ~/.config/bat.
(by the way, I hope that you already know that you can always use something like bat -lerl rebar.lock to highlight a file in Erlang mode)
This is a great idea. From a usability perspective, it would be ideal if bat users weren't even aware that bat was using sublime syntax files under the hood -- if it supported the syntax of every programming language under the sun, a user would only have to learn bat's simple config syntax to meet their every need.
Regarding the config file's format, I think INI and TOML are a bit nicer than YAML and JSON. They're less pedantic about syntax (i.e. INIs don't care about quoting strings, or about structuring dictionaries and arrays properly, while a typo in a large JSON file can result in very frustrating error messages, and an empty YAML file won't even parse).
My 2 cents is that power users will always have a need to override default configuration (in this case, the Sublime syntax definitions). They might find that using a specific highlight syntax for a custom file works better, they want to add common but not standard extensions (my case), or they are working on a system that doesn't use the standard extensions for some reason.
Released in v0.8.0.
Most helpful comment
Released in v0.8.0.