Although I agree with other commenters that your command can't compare to all of bat's features, many of which I appreciate... thank you for sharing this tip, I didn't know about `highlight` and I can't install `bat` at work.

This will live in my .bashrc for a long time:

    cat() {
      if [[ -t 1 ]]; then
        command cat "$@" | highlight --force -O xterm256
      else
        # plain cat to pipe into other things
        command cat "$@"
      fi
    }

This... doesn't work? Everything just comes out green. It's not clear to me how 'highlight' could even possibly know what syntax it's supposed to be highlighting when processing stdin, unless it ingests the whole thing until EOF and then applies some kind of fuzzy logic. If you feed it a filename as an argument, it just checks the extension.

[deleted]

curious, how did you have highlight installed?

i'd change the third line so you can actually get syntax highlighting:

    command highlight --stdout --force -O xterm256 "$@"