Syntax highlighting/colorizing cat

前端 未结 18 1897
不思量自难忘°
不思量自难忘° 2020-12-02 03:39

Is there a method to colorize the output of cat, the way grep does.

For grep, in most consoles it displays a colored output hi

18条回答
  •  温柔的废话
    2020-12-02 04:16

    From late April 2018 onwards:

    Bat - A cat(1) clone with syntax highlighting and Git integration.

    The project is a cat clone with support for colors and customizations written in Rust. It offers not only syntax highlighting with multiple themes, but also Git integration. As described in the documentation:

    bat tries to achieve the following goals:

    • Provide beautiful, advanced syntax highlighting
    • Integrate with Git to show file modifications
    • Be a drop-in replacement for (POSIX) cat
    • Offer a user-friendly command-line interface

    It is, needless to say, much faster than pygmentize and does not choke when confronted with large files.

    Source code and binary releases + installation instructions can be found in the Github repository, as well as a comparison to alternative programs.

提交回复
热议问题