mirror of https://github.com/sharkdp/bat.git
Compare commits
4 Commits
7b0f64baa5
...
89b9894af0
Author | SHA1 | Date |
---|---|---|
Ethan P | 89b9894af0 | |
Sharun | 9eaed3e3f0 | |
sblondon | d5bd4aa93f | |
Ethan P. | 943a4c3d1d |
|
@ -6,6 +6,7 @@
|
||||||
- `bat --squeeze-blank`/`bat -s` will now squeeze consecutive empty lines, see #1441 (@eth-p) and #2665 (@einfachIrgendwer0815)
|
- `bat --squeeze-blank`/`bat -s` will now squeeze consecutive empty lines, see #1441 (@eth-p) and #2665 (@einfachIrgendwer0815)
|
||||||
- `bat --squeeze-limit` to set the maximum number of empty consecutive when using `--squeeze-blank`, see #1441 (@eth-p) and #2665 (@einfachIrgendwer0815)
|
- `bat --squeeze-limit` to set the maximum number of empty consecutive when using `--squeeze-blank`, see #1441 (@eth-p) and #2665 (@einfachIrgendwer0815)
|
||||||
- `PrettyPrinter::squeeze_empty_lines` to support line squeezing for bat as a library, see #1441 (@eth-p) and #2665 (@einfachIrgendwer0815)
|
- `PrettyPrinter::squeeze_empty_lines` to support line squeezing for bat as a library, see #1441 (@eth-p) and #2665 (@einfachIrgendwer0815)
|
||||||
|
- Syntax highlighting for JavaScript files that start with `#!/usr/bin/env bun` #2913 (@sharunkumar)
|
||||||
|
|
||||||
## Bugfixes
|
## Bugfixes
|
||||||
|
|
||||||
|
@ -33,6 +34,7 @@
|
||||||
- Relax syntax mapping rule restrictions to allow brace expansion #2865 (@cyqsimon)
|
- Relax syntax mapping rule restrictions to allow brace expansion #2865 (@cyqsimon)
|
||||||
- Apply clippy fixes #2864 (@cyqsimon)
|
- Apply clippy fixes #2864 (@cyqsimon)
|
||||||
- Faster startup by offloading glob matcher building to a worker thread #2868 (@cyqsimon)
|
- Faster startup by offloading glob matcher building to a worker thread #2868 (@cyqsimon)
|
||||||
|
- Display which theme is the default one in colored output, see #2838 (@sblondon)
|
||||||
|
|
||||||
## Syntaxes
|
## Syntaxes
|
||||||
|
|
||||||
|
|
12
README.md
12
README.md
|
@ -204,19 +204,19 @@ bat main.cpp | xclip
|
||||||
`MANPAGER` environment variable:
|
`MANPAGER` environment variable:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
|
export MANPAGER="sh -c 'sed -u -e \"s/\\x1B\[[0-9;]*m//g; s/.\\x08//g\" | bat -p -lman'"
|
||||||
man 2 select
|
man 2 select
|
||||||
```
|
```
|
||||||
(replace `bat` with `batcat` if you are on Debian or Ubuntu)
|
(replace `bat` with `batcat` if you are on Debian or Ubuntu)
|
||||||
|
|
||||||
It might also be necessary to set `MANROFFOPT="-c"` if you experience
|
|
||||||
formatting problems.
|
|
||||||
|
|
||||||
If you prefer to have this bundled in a new command, you can also use [`batman`](https://github.com/eth-p/bat-extras/blob/master/doc/batman.md).
|
If you prefer to have this bundled in a new command, you can also use [`batman`](https://github.com/eth-p/bat-extras/blob/master/doc/batman.md).
|
||||||
|
|
||||||
Note that the [Manpage syntax](assets/syntaxes/02_Extra/Manpage.sublime-syntax) is developed in this repository and still needs some work.
|
> [!WARNING]
|
||||||
|
> This will [not work](https://github.com/sharkdp/bat/issues/1145) out of the box with Mandoc's `man` implementation.
|
||||||
|
>
|
||||||
|
> Please either use `batman`, or convert the shell script to a [shebang executable](https://en.wikipedia.org/wiki/Shebang_(Unix)) and point `MANPAGER` to that.
|
||||||
|
|
||||||
Also, note that this will [not work](https://github.com/sharkdp/bat/issues/1145) with Mandocs `man` implementation.
|
Note that the [Manpage syntax](assets/syntaxes/02_Extra/Manpage.sublime-syntax) is developed in this repository and still needs some work.
|
||||||
|
|
||||||
#### `prettier` / `shfmt` / `rustfmt`
|
#### `prettier` / `shfmt` / `rustfmt`
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
Submodule assets/syntaxes/01_Packages contains modified content
|
||||||
|
diff --git syntaxes/01_Packages/JavaScript/JavaScript.sublime-syntax syntaxes/01_Packages/JavaScript/JavaScript.sublime-syntax
|
||||||
|
index 05a4fed6..78a7bf55 100644
|
||||||
|
--- syntaxes/01_Packages/JavaScript/JavaScript.sublime-syntax
|
||||||
|
+++ syntaxes/01_Packages/JavaScript/JavaScript.sublime-syntax
|
||||||
|
@@ -5,7 +5,7 @@ name: JavaScript
|
||||||
|
file_extensions:
|
||||||
|
- js
|
||||||
|
- htc
|
||||||
|
-first_line_match: ^#!\s*/.*\b(node|js)\b
|
||||||
|
+first_line_match: ^#!\s*/.*\b(node|bun|js)\b
|
||||||
|
scope: source.js
|
||||||
|
variables:
|
||||||
|
bin_digit: '[01_]'
|
|
@ -30,6 +30,7 @@ use directories::PROJECT_DIRS;
|
||||||
use globset::GlobMatcher;
|
use globset::GlobMatcher;
|
||||||
|
|
||||||
use bat::{
|
use bat::{
|
||||||
|
assets::HighlightingAssets,
|
||||||
config::Config,
|
config::Config,
|
||||||
controller::Controller,
|
controller::Controller,
|
||||||
error::*,
|
error::*,
|
||||||
|
@ -200,11 +201,18 @@ pub fn list_themes(cfg: &Config, config_dir: &Path, cache_dir: &Path) -> Result<
|
||||||
let mut stdout = stdout.lock();
|
let mut stdout = stdout.lock();
|
||||||
|
|
||||||
if config.colored_output {
|
if config.colored_output {
|
||||||
|
let default_theme = HighlightingAssets::default_theme();
|
||||||
for theme in assets.themes() {
|
for theme in assets.themes() {
|
||||||
|
let default_theme_info = if default_theme == theme {
|
||||||
|
" (default)"
|
||||||
|
} else {
|
||||||
|
""
|
||||||
|
};
|
||||||
writeln!(
|
writeln!(
|
||||||
stdout,
|
stdout,
|
||||||
"Theme: {}\n",
|
"Theme: {}{}\n",
|
||||||
Style::new().bold().paint(theme.to_string())
|
Style::new().bold().paint(theme.to_string()),
|
||||||
|
default_theme_info
|
||||||
)?;
|
)?;
|
||||||
config.theme = theme.to_string();
|
config.theme = theme.to_string();
|
||||||
Controller::new(&config, &assets)
|
Controller::new(&config, &assets)
|
||||||
|
|
|
@ -272,6 +272,24 @@ fn squeeze_limit_line_numbers() {
|
||||||
.stdout(" 1 line 1\n 2 \n 3 \n 4 \n 5 line 5\n 6 \n 7 \n 8 \n 9 \n 10 \n 20 line 20\n 21 line 21\n 22 \n 23 \n 24 line 24\n 25 \n 26 line 26\n 27 \n 28 \n 29 \n 30 line 30\n");
|
.stdout(" 1 line 1\n 2 \n 3 \n 4 \n 5 line 5\n 6 \n 7 \n 8 \n 9 \n 10 \n 20 line 20\n 21 line 21\n 22 \n 23 \n 24 line 24\n 25 \n 26 line 26\n 27 \n 28 \n 29 \n 30 line 30\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn list_themes() {
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
|
let default_theme_chunk = "Monokai Extended Light\x1B[0m (default)";
|
||||||
|
|
||||||
|
#[cfg(not(target_os = "macos"))]
|
||||||
|
let default_theme_chunk = "Monokai Extended\x1B[0m (default)";
|
||||||
|
|
||||||
|
bat()
|
||||||
|
.arg("--color=always")
|
||||||
|
.arg("--list-themes")
|
||||||
|
.assert()
|
||||||
|
.success()
|
||||||
|
.stdout(predicate::str::contains("DarkNeon").normalize())
|
||||||
|
.stdout(predicate::str::contains(default_theme_chunk).normalize())
|
||||||
|
.stdout(predicate::str::contains("Output the square of a number.").normalize());
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg_attr(any(not(feature = "git"), target_os = "windows"), ignore)]
|
#[cfg_attr(any(not(feature = "git"), target_os = "windows"), ignore)]
|
||||||
fn short_help() {
|
fn short_help() {
|
||||||
|
|
Loading…
Reference in New Issue