2019-06-21 23:48:37 +02:00
# bat-extras: prettybat
2020-04-06 20:42:45 +02:00
Pretty-print source code and highlight it with `bat` .
The only thing better than syntax highlighting? Syntax highlighting *and* code formatting. This script combines the best of both worlds by using [various formatters ](#Languages ) to format source files before using `bat` to highlight them.
2019-06-21 23:48:37 +02:00
2020-05-16 05:53:59 +02:00
## Usage
2019-06-21 23:48:37 +02:00
2020-10-04 20:51:02 +02:00
prettybat [OPTIONS] [PATH...]
2019-06-21 23:48:37 +02:00
2020-05-16 05:53:59 +02:00
## Options
2019-06-21 23:48:37 +02:00
Every option is passed through to `bat` .
See `man bat` for more information.
2019-06-22 00:51:13 +02:00
## Languages
2019-09-27 03:02:21 +02:00
| Language | Formatter |
| -------------------- | ----------------------------------------------------------- |
| JavaScript (JS, JSX) | [prettier ](https://prettier.io/ ) |
| TypeScript (TS, TSX) | [prettier ](https://prettier.io/ ) |
| CSS, SCSS, SASS | [prettier ](https://prettier.io/ ) |
| Markdown | [prettier ](https://prettier.io/ ) |
| JSON | [prettier ](https://prettier.io/ ) |
| YAML | [prettier ](https://prettier.io/ ) |
| HTML | [prettier ](https://prettier.io/ ) |
| Rust | [rustfmt ](https://github.com/rust-lang/rustfmt ) |
| Bash | [shfmt ](https://github.com/mvdan/sh ) |
| C | [ClangFormat ](https://clang.llvm.org/docs/ClangFormat.html ) |
| C++ | [ClangFormat ](https://clang.llvm.org/docs/ClangFormat.html ) |
| Objective-C | [ClangFormat ](https://clang.llvm.org/docs/ClangFormat.html ) |
2020-12-16 19:03:36 +01:00
| Python | [black ](https://black.readthedocs.io/ ) |
2019-06-22 00:51:13 +02:00
2019-06-21 23:48:37 +02:00
## Caveats
2020-10-03 04:50:48 +02:00
- The header displayed by bat will show `STDIN` instead of the filename (`bat 0.13` or older).
2019-06-22 00:51:13 +02:00
- The git changes sidebar will not work with files that have been formatted.
2019-06-21 23:48:37 +02:00
2019-09-18 23:15:45 +02:00
## Installation
This script is a part of the `bat-extras` suite of scripts. You can find install instructions [here ](../README.md#installation ).
2019-06-21 23:48:37 +02:00
## Issues?
If you find an issue or have a feature suggestion, make a pull request or issue through GitHub!
Contributions are always welcome.