Skip to content

This document is a WORK IN PROGRESS.
This is just a quick personal cheat sheet: treat its contents with caution!


bat

A cat clone with syntax highlighting and Git integration.

Reference(s)

Table of contents


Install

# apk add bat
# apt install rust-bat
# dnf install rust-bat
# emerge -a sys-apps/bat
# nix-env -iA nixos.bat
# nix-env -iA nixpkgs.bat
# pacman -S eza

TODO


# xbps-install -S bat
# zypper install bat

Config

$ vi $HOME/.bashrc # or ${ZDOTDIR:-${HOME}}/.zshrc or wherever

    > ...
  + >
  + > # cat/bat
  + > #
  + > # prerequisite:
  + > #   * bat: https://repology.org/project/bat/versions
  + > #
  + > export BAT_THEME="ansi" # change bat theme
  + > #export MANPAGER="sh -c 'col -bx | bat -l man -p'" # colorize pager for man, DEPRECATED
  + > alias cat="bat"
  + > alias fh="find . -exec bat {} +" # "find here" with bat preview
  + > alias fr="find / -exec bat {} +" # "find root" with bat preview

$ source $HOME/.bashrc # or ${ZDOTDIR:-${HOME}}/.zshrc or wherever

TODO: * https://github.com/eth-p/bat-extras/blob/master/doc/batgrep.md * https://github.com/eth-p/bat-extras/blob/master/doc/batman.md * https://github.com/eth-p/bat-extras/blob/master/doc/prettybat.md


Use

$ bat test.md
$ bat *.md

If this cheat sheet has been useful to you, then please consider leaving a star here.