v0.27.0
Features
- Map
.yamllint,.prettierrcand.eslintrcto YAML syntax highlighting, see #4156 (@yusufemreboyraz) - Map
.clang-tidyto YAML syntax highlighting, see #4150 (@yusufemreboyraz) - Automatically build the syntax/theme cache on first run when custom themes or syntaxes are present but no cache exists yet, so newly installed dotfiles work without a manual
bat cache --build. Use--no-custom-assetsto opt out. Closes #4017, see #4038 (@mmustafasenoglu) - Add
-b/--number-nonblankflag to only number non-blank lines, forcat -bcompatibility. Closes #3856, see #3857 (@MeGaurav4) - Add a
--sanitize=<auto|always|never>flag for safe display of untrusted input. It substitutes terminal-active control bytes (escape, cursor moves, charset switches, beep, etc.) and Unicode bidi / zero-width formatting characters with the Unicode replacement character (U+FFFD). Mitigates Trojan-Source-style spoofing (CVE-2021-42574). See #3729 (@curious-rabbit) - Map justfile, Justfile, .justfile, and *.justfile to Makefile syntax highlighting, see #3623 (@zachvalenta)
- Map
.kube/configto YAML syntax highlighting, see #3911 (@logarithmone1128) - Preserve
--diffchange markers and snip separators when--plainis set. Closes #3630, see #3643 (@mvanhorn) - Added support for
hidden_file_extensionsfrom.sublime-syntaxfiles, see #3613 (@Matei02355) - Add word wrapping mode via
--wrap=word, see #3597 (@veeceey) - Support configuring
--terminal-widthviaBAT_WIDTH, see #3679 (@officialasishkumar) - Implement
--unbufferedmode for streaming input, allowing partial lines to display immediately (e.g.tail -f | bat -u). Closes #3555, see #3583 (@mainnebula) - Added an initial
flake.nixfor a ready made development environment; see #3578 (@vorburger) - Add
--quiet-empty(-E) flag to suppress output when input is empty. Closes #1936, see #3563 (@NORMAL-EX) - Improve native man pages and command help syntax highlighting by stripping overstriking, see #3517 (@akirk)
- Add
--fallback-syntax/--fallback-languageto apply syntax highlighting only when auto-detection fails, see #1341 (@Xavrir) - Map
BUILDcase sensitively to Python (Starlark) for Bazel, see #3576 (@vorburger) - Syntax highlighting for Python files using uv as script runner in shebang #3689 (@janlarres)
Bugfixes
- Track reverse video (SGR 7 / 27) in the ANSI style tracker so it is re-emitted like bold, dim, italic, and underline, and is no longer dropped after the first wrapped line when displaying ANSI input, see #4144 (@BlueX888)
- Preserve buffered stdin when
$LESSOPENtemporary-file mode falls back to the original input, and handle CRLF line endings on returned temp paths, see #4158 (@xgbtxy) - Skip cache metadata validation when
--no-custom-assetsis set so outdated or malformed caches do not block fallback to integrated assets, see #4157 (@xgbtxy) - Only show style decorations with
--decorations=autowhen stdout is interactive, so piped--color=alwaysoutput no longer includes the header, grid, or line numbers, see #4151 (@draarivpatel-ui) - Break
--wrap=wordlines at whitespace in earlier highlighted tokens or before ANSI escape sequences instead of in the middle of a word, closes #4139, see #4140 (@mansur-akhmadi) - Fix
bat cache --helpreturning exit code 1 instead of 0. Remove.arg_required_else_help(true)from the cache subcommand and show help when no arguments are provided. See #3798, #3831 and #3837 (@Amilliox) - Fix builtin pager (minus) not responding to search (
/,?,n,N) and navigation (PgUp,PgDown, arrows,g,G) keys.HashedEventRegisterwas overriding all defaultminusbindings instead of extending them. Addgenerate_default_bindings()before custom bindings. See #3831, #3798 and #3837 (@Amilliox) - Build the cache automatically on first run when custom themes or syntaxes are in subdirectories, see #4131 (@NotAFlightRisk)
- Do not run filter commands from the configuration of the Git repository that contains the displayed file, see #4127 (@curious-rabbit)
- Ignore empty
--ignored-suffixvalues to avoid a stack overflow, see #4122 (@spicysharkco) - Fix
--number-nonblankcounting empty UTF-16 lines, see #4118 (@pcbeingused333) - Fix automatic cache build progress polluting stdout, see #4130 (@intertermux-code)
- Don't emit
--highlight-lineescape sequences (background color oransitheme underline) when colors are disabled with--color=never. Closes #4099, see #4100 (@DeviousCardi) - Fix missing colors, pager, and decorations in mintty/MSYS2 and Cygwin terminals on Windows, see #4115 (@rezamuliawijaya)
- Make full-path
--map-syntaxpatterns and the built-in$HOMEand$XDG_CONFIG_HOMEmappings work on Windows, see #4113 (@b84330808) - Keep configuration and BAT_OPTS active for option-like filenames after
--, and report invalid configuration for help-like filenames, see #4112 (@Marve10s) - Keep emoji sequences together within text chunks when wrapping content, and measure their combined display width, see #4108 (@Marve10s)
- Preserve full-path syntax mappings when removing ignored filename suffixes, see #4111 (@Marve10s)
- Fix UTF-16 line splitting at unaligned newline bytes corrupting text and shifting line ranges, see #4110 (@Marve10s)
- Respect
NO_COLORfor the[bat error]and[bat warning]prefixes, see #4048 (@qodelicious) - Offer the valid
--wrapvalueautoinstead of the rejectedalwaysin the PowerShell completion, see #4070 (@ump45nose) - Report
BAT_CONFIG_DIRinbat --diagnostic, so bug reports show a config directory that overrides$XDG_CONFIG_HOME. See #4068 (@ump45nose) - Ignore a UTF-8 byte order mark at the start of the config file instead of treating it as part of the first argument, see #4103 (@jaeminbird)
- Keep backslashes in the pager command on Windows, so
BAT_PAGER=C:\tools\less.exeis found instead of becomingC:toolsless.exe, see #4104 (@jaeminbird) - Fix
bathanging forever on JavaScript (and Svelte) code where an expression is followed by a block comment, e.g.a /* x */. Closes #4080, see #4091 (@NavpreetSSidhu) - Fix the first line of UTF-16BE input swallowing the second line, which broke line numbers,
--line-rangeand highlighting, see #4102 (@cindykrafft) - Exit quietly with status 0 instead of panicking when stdout is closed early (broken pipe) on auxiliary output paths such as
--completion,--config-file,--diagnostic,--generate-config-file,--set-terminal-titleandcache --build/--clear, matching the main output path since #232, closes #4034, see #4035 (@Mathjk) - Fix escape sequence handling in
--strip-ansiand--sanitize.--sanitizeno longer removes escape sequences, which could hide text, see #4024 (@curious-rabbit) - Report unknown languages in plain piped output, see #4001 (@ryanchou1994)
- Track strikethrough (SGR 9 / 29) in the ANSI style tracker so it is re-emitted like bold, dim, italic, and underline, and is no longer dropped after the first highlighted token when displaying ANSI input with syntax highlighting, see #4015 (@mikehasa)
- Allow boolean flags to be given more than once, so that a flag set in the config file can also be passed on the command line without erroring, see #3912 (@logarithmone1128)
- Allow options that take a value (
--binary,--italic-text,--nonprintable-notation,--fallback-syntax,--squeeze-limit) to be given more than once, so that a value from the config file can be overridden on the command line, see #4102 (@Huang-404-Q) - Use parsed CLI arguments to detect number flags, see #3908 (@cuishuang)
- Detect binary content beyond the first line, preventing encrypted files with early line breaks from being treated as text. Closes #3554, see #3877 (@Matei02355)
- Use the last occurrence of numbering and plain flags in combined short arguments, see #3897 (@cuishuang)
- Avoid a spurious Cargo manifest error during installation from Git, see #3899 (@rootsec1)
- Avoid repeated scans of long lines in Log syntax highlighting, see #3876 (@Matei02355)
- Fix
--list-languagesrespecting--paging=never, see #3828 (@cyphercodes) - Fix
--sanitizepassing through the bidi control characters U+200E, U+200F and U+061C, see #3862 (@lenamonj) --strip-ansi: also strip 8-bit C1 introducers (U+0090, U+0098, U+009B, U+009D, U+009E, U+009F) and DCS/SOS/PM/APC sequence bodies, which previously passed through. See #3729 (@curious-rabbit)- Fix
--ignored-suffixnot falling back to first-line/shebang detection when the ignored suffix is also a registered extension (e.g.--ignored-suffix .txton a shebang script), see #2745 and #3816 (@adnrivera) - Fix
capacity overflowpanic when printing a snip separator at--terminal-width=1with multiple line ranges. Closes #3803, see #3804 (@leeewee) - Pass
--no-pagingtobatinvocations inside the bash / zsh / fish / PowerShell shell completion scripts so that shell-level pager wiring (e.g.LESSOPEN='|-bat -f -pp %s') cannot inject ANSI escape sequences into the completion candidates. Closes #3760 (@mvanhorn) - Quote filenames before substituting them into
$LESSOPEN/$LESSCLOSEtemplates, preventing shell injection when a filename contains shell metacharacters, see #3726 (@curious-rabbit) - Fix
--list-themesunconditionally probing the terminal via OSC 10/11 even when--themewas set to an explicit value, see #3700 (regression introduced in bc42149). (@optimistiCli) - Fix inverted
$LESSCLOSEwarning so bat warns on nonzero exit, not on success. See #3654 (@cuiweixie) - Sanitize control characters in filenames before displaying them in the file header, error messages, and the terminal title, preventing ANSI escape injection via crafted filenames. Closes #3054, see #3691 (@curious-rabbit)
- Report initial input read errors instead of treating them as empty input. Closes #3002, see #3706 (@lawrence3699)
- Treat ZIP archives as binary content based on their magic header, see #3686 (@officialasishkumar)
- Fix i686
.debpackage using incorrect architecture name (i686instead ofi386), preventing installation on Debian. Closes #3611, see #3650 (@Sim-hu) - Fix inconsistent
.debMUSL package names (aarch64-musl usedarm64instead ofmusl-linux-arm64, andmusleabihftarget missedbat-muslprefix). Closes #3482, see #3642 (@mvanhorn) - Fix incorrect text width computation when using
--binary=as-textwith non-printable characters in caret notation, see #3640 and #3631 (@eyupcanakman) - Fix
BAT_CONFIG_DIRpointing at system config directory causing duplicate flag errors. Closes #3589, see #3620 (@Xavrir) - Fix syntax highlighting for symlinked files when the symlink name has no extension but the target does. Closes #1001, see #3621 (@Xavrir)
- Report error when pager is missing instead of silently falling back, see #3588 (@IMaloney)
- Fix
--wrap=neverand-Sflags being ignored when piping to pager, see #3592 (@IMaloney) - Fix crash with BusyBox
lesson Windows, see #3527 (@Anchal-T) - Fix
bat cache --helpfailing with 'unexpected argument' error, see #3580 and #3560 (@NORMAL-EX) --helpnow correctly honors--pager=builtin. See #3516 (@keith-hall)--helpnow correctly honors custom themes. See #3524 (@keith-hall)- Fixed test compatibility with future Cargo build directory changes, see #3550 (@nmacl)
- Fixed bug caused by using
--plainand--terminal-width=Nflags simultaneously, see #3529 (@H4k1l) - Fixed syntax tests path, see #3610 (@foxfromworld)
- Fix zsh tab completion word-splitting language names containing spaces (e.g.
HTML (Jinja2),Apache Conf), see #3693 (@YoshKoz) - Fix zsh tab completion offering invalid
-larguments (file globs, paths, hidden filenames) sourced from the second column of--list-languages. Closes #3735, see #3737 (@truffle-dev) - Fix
usizeunderflow in--list-languageswhen--terminal-widthis smaller than the longest language name, see #3812 (@greymoth-jp) --sanitize=alwaysnow also sanitizes piped output.--sanitize=autonow sanitizes every file type, but only when the output is a terminal, see #4141 (@curious-rabbit)- Show changes in
--diffmode and the change-marker column in Git repositories that use the SHA-256 object format (git init --object-format=sha256), see #4143 (@BlueX888) - Skip untracked files and files outside a Git repository in
--diffmode instead of printing an empty frame, see #4148 (@thejesh23) - Recognize the end of an OSC 8 hyperlink in ANSI input, so later text is no longer wrapped in redundant hyperlink-close sequences, see #4136 (@divya0795)
Other
- Use git version of cross. See #3533 (@OctopusET)
- Bump MSRV to 1.88, update
timecrate to 0.3.47 to fix RUSTSEC-2026-0009, see #3581 (@NORMAL-EX) - Allow home and end keys to be used with builtin pager, see #3651 (@keith-hall)
- Builtin syntax mapping: cleanup matcher glob parsing logic #3652 (@cyqsimon)
- Statically link the CRT for MSVC builds via Cargo config to avoid runtime DLL dependencies. Closes #3634, see #3692 (@barry3406)
- Replace
libgit2with a pure Rust implementation of git calledgitoxide, see PR #3703 (@blinxen) - Document submodule initialization when rebuilding syntax and theme assets, see #3801 (@xfocus3)
- Fix anchor case in
doc/assets.mdlinks, see #4026 (@ump45nose) - Pin the i686 GNU CI runner to Ubuntu 24.04 to avoid
socketpairfailures on Ubuntu 26.04, see #4101 (@PerchAnton) - Fix dead Visual C++ Redistributable link in README, see #3895 (@1t1sCooL)
- Document
StripAnsiModeand its variants in rustdoc, see #4067 (@ump45nose) - Update Cargo dependencies to resolve current RustSec advisories, see #3861 (@TyceHerrman)
- Add instructions for removing fish help abbreviations to README, see #3655 (@claw-explorer). Closes #3536
- Add .NET slnx extension, see #3682 (@ltrzesniewski)
Syntaxes
- Highlight Rust
asyncandawaitas keywords. Closes #1534, see #3892 (@JMak-Security) - Add shebang-based detection for Tcl (
tclsh,wish) and Expect (expect) scripts, see #3647 (@mvanhorn) - Change the URL of Zig submodule from GitHub to Codeberg, see #3519 (@sorairolake)
- Don't color strings inside CSV files, to make it easier to tell which column they belong to, see #3521 (@keith-hall)
- Add syntax highlighting support for COBOL, see #3584 (@adukhan99)
- Fixed manpage syntax so that ANSI escape codes don't get incorrectly highlighted and thus broken, see #3586 (@BlueElectivire)
- Map several Google Cloud CLI config files to their appropriate syntax #3635 (@victor-gp)
- Map all ignore dotfiles to Git Ignore syntax #3636 (@victor-gp)
- Improved Kotlin syntax, see #3699 (@guille)
- Include subdirectories in SSH Config syntax mapping, see #3758 (@injust)
- Add Ghostty syntax mapping, see #3759 (@injust)
- Add syntax highlighting for
Caddyfile#3789 (@CosmicHorrorDev) - Include
.code-workspaceas a JSON extension #3809 (@dhruvkb) - Add syntax mapping for DNF repo configuration files, see #3814 (@injust)
- Add syntax mapping for Podman
.quadletsfiles, see #4069 (@injust) - Add syntax highlighting for CUE, see #4094 (@nikarh)
Themes
- Remove the Visual Studio Dark+ theme, see #3552 (@CosmicHorrorDev)