Where Does bat Store Config and Syntax Cache?
bat reads a config file plus a built syntax cache from OS-standard folders. Finding both with flags and adding custom syntaxes.
Last updated
bat resolves its files in two steps. The config file sets themes, paging and flags; the cache holds compiled syntax definitions and themes for speed. Neither location is guessed: bat --config-file and bat --cache-dir print the exact paths on your machine, which beats every cheat sheet.
Typical spots follow OS conventions under a bat folder, overridable with BAT_CONFIG_PATH or BAT_CONFIG_DIR. Custom .sublime-syntax files drop into syntaxes under the config dir, then bat cache --build compiles them in. A system-wide config in /etc/bat/config (or ProgramData on Windows) prepends to yours when present.
Where Bat stores this, by platform
%APPDATA%\bat\config
User config file; cache parallels it under local app data. Confirm both with bat --config-file and bat --cache-dir. System default prepends from C:\ProgramData\bat\config.
~/Library/Application Support/bat/config
Same role as elsewhere; verify with bat --config-file since install methods vary. Generate a starter with bat --generate-config-file.
~/.config/bat/config
Honors XDG base dirs. Cache sits at the parallel ~/.cache/bat. System config at /etc/bat/config appends before user settings.
Frequently asked questions
How do I find bat's actual config path?
Run bat --config-file for the file and bat --config-dir for its folder. Those reflect your OS, install method and environment overrides. Point BAT_CONFIG_PATH elsewhere to relocate without moving files.
How do I add a custom syntax to bat?
Drop .sublime-syntax files into the syntaxes folder under bat --config-dir, then run bat cache --build. Rebuild after every addition or edit. Clear with bat cache --clear when experiments go wrong.
Notice an outdated path? Let us know.