Commit Graph

240 Commits

Author SHA1 Message Date
Martin Nordholts
76aa138230 CHANGELOG.md: Prepare a new "unreleased" section 2022-01-08 20:05:43 +01:00
Martin Nordholts
d3956be616 CHANGELOG.md: Rearrange and update for v0.19.0 2022-01-08 17:01:20 +01:00
Martin Nordholts
68528983d7 Mark MappingTarget as #[non_exhaustive] for increased semver flexibility
This will allow us to add new enum variants in the future without breaking
semver compatibility. See
https://doc.rust-lang.org/reference/attributes/type_system.html#the-non_exhaustive-attribute

Since we already added an enum variant since v0.18.3, now is a good time to mark
it as `#[non_exhaustive]`.
2022-01-04 08:19:51 +01:00
Mahdi Dibaiee
6dc621ec18 Set minimum supported rust version to 1.51 2021-12-30 07:58:15 +01:00
dependabot[bot]
3358b075fb
Bump assets/syntaxes/02_Extra/TypeScript from a607ddf to ba45efd (#1834)
* Bump assets/syntaxes/02_Extra/TypeScript from `a607ddf` to `ba45efd`

Bumps [assets/syntaxes/02_Extra/TypeScript](https://github.com/Microsoft/TypeScript-Sublime-Plugin) from `a607ddf` to `ba45efd`.
- [Release notes](https://github.com/Microsoft/TypeScript-Sublime-Plugin/releases)
- [Commits](a607ddfec9...ba45efd058)

---
updated-dependencies:
- dependency-name: assets/syntaxes/02_Extra/TypeScript
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* Do machine-conversion from .tmLanguage to .sublime-syntax

The new .sublime-syntax files are pure "Tools" -> "Developer" -> "New Syntax
from ..." conversions from a licenced version of Sublime Text, Version 3.1.1,
Build 3176 with the .tmLanguage as the source files. No manual changes has been
made.

* Add CHANGELOG.md entry

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Martin Nordholts <enselic@gmail.com>
2021-12-12 20:07:50 +01:00
dependabot[bot]
a02713dc15
Bump assets/syntaxes/02_Extra/PowerShell from 4a0a076 to 742f0b5 (#1935)
* Bump assets/syntaxes/02_Extra/PowerShell from `4a0a076` to `742f0b5`

Bumps [assets/syntaxes/02_Extra/PowerShell](https://github.com/PowerShell/EditorSyntax) from `4a0a076` to `742f0b5`.
- [Release notes](https://github.com/PowerShell/EditorSyntax/releases)
- [Commits](4a0a076661...742f0b5d4b)

---
updated-dependencies:
- dependency-name: assets/syntaxes/02_Extra/PowerShell
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* Do machine-conversion from .tmLanguage to .sublime-syntax

The new .sublime-syntax file is a pure "Tools" -> "Developer" -> "New Syntax
from ..." conversion from a licenced version of Sublime Text, Version 3.1.1,
Build 3176 with the .tmLanguage as the source file. No manual changes has been
made.

* Update regression test and add CHANGELOG.md entry

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Martin Nordholts <enselic@gmail.com>
2021-12-12 19:41:04 +01:00
dependabot[bot]
ee1f5a9e89
Bump assets/syntaxes/02_Extra/SCSS_Sass from 63819a1 to d3d9404 (#1766)
* Bump assets/syntaxes/02_Extra/SCSS_Sass from `63819a1` to `d3d9404`

Bumps [assets/syntaxes/02_Extra/SCSS_Sass](https://github.com/braver/SublimeSass) from `63819a1` to `d3d9404`.
- [Release notes](https://github.com/braver/SublimeSass/releases)
- [Commits](63819a1ab6...d3d9404640)

---
updated-dependencies:
- dependency-name: assets/syntaxes/02_Extra/SCSS_Sass
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update regression test and add CHANGELOG.md entry

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Martin Nordholts <enselic@gmail.com>
2021-12-12 18:58:30 +01:00
Martin Nordholts
a3ea798246
Credit syntax definition and theme authors with new --acknowledgements option (#1971)
The text that is printed is generated when building assets, by analyzing LICENSE
and NOTICE files that comes with syntaxes and themes.

We take this opportunity to also add a NOTICE file as defined by Apache License 2.0.
2021-12-11 14:00:45 +01:00
Ethan P
63ad53817d
Improved ANSI passthrough (#1596)
Improve handling of ANSI passthrough. Fix ANSI passthrough for --wrap=never. Add test for ANSI passthrough.
2021-12-08 16:06:42 +01:00
Martin Nordholts
7fceb4878f
Load themes lazily for improved startup time (#1969)
This is for #951. Syntax lazy-loading will come later and have a much bigger
impact, but lazy-loading of themes does not have negligible impact.
2021-12-06 09:14:15 +01:00
Ersikan
29711c178a
Better syntax highlighting for Dart (#1959)
Remove unmaintained Dart syntax submodule. Add elMuso/Dartlight as submodule. Update Dart syntax highlighting. Add changes to changelog.
2021-12-06 08:40:43 +01:00
David Peter
3338699257 Remove the 'requirements.txt' syntax
This is needed because the syntax is only available under GPL v3.0,
which is not compatible with `bat`s license.
2021-11-28 16:28:14 +01:00
Bojan Durdevic
9a2979df5f Changelog update 2021-11-24 07:27:36 +01:00
Martin Nordholts
d7671fa8e3 Remove the code related to minimal_syntaxes.bin
To get fast startup, syntect will instead start to lazy-load syntaxes. See
https://github.com/trishume/syntect/pull/393 and discussions in linked PRs.
2021-11-22 20:42:01 +01:00
Shun Sakai
619cf6e6d6 Add MediaWiki syntax 2021-11-22 19:46:29 +01:00
Bojan Đurđević
d6ed5e6746
Support for ignored-suffix CLI arguments (#1892) 2021-11-19 17:05:23 +01:00
cbolgiano
7fe4fdf33d
Introduce MapExtensionToUnknown MappingTarget (#1889)
Co-authored-by: Martin Nordholts <enselic@gmail.com>
2021-10-25 17:59:12 +02:00
Martin Nordholts
4081ace4b9 Include git hash in bat -V and bat --version output if present
I had to use a `lazy_static` due to that the clap API that only accepts a
reference to a version string. And, in our code, only a 'static reference to a
version string.

Code could probably be refactored to accept a "normal" reference, but that would
be a major undertaking.
2021-10-24 11:36:55 +02:00
Martin Nordholts
6eb2cc9cac Add LiveScript syntax
The file `LiveScript.sublime-syntax` is a pure export from a licenced version
of Sublime Text, Version 3.1.1, Build 3176 with
assets/syntaxes/02_Extra/LiveScript/Syntaxes/LiveScript.tmLanguage as the source
file.
2021-10-23 13:35:32 +02:00
Diva M
3a3cd0acba changelog 2021-10-17 21:21:23 +02:00
Georgy Komarov
d04a83de7b Add Racket syntax 2021-10-03 19:17:26 +02:00
Martin Nordholts
418fce5683 Bump MSRV to 1.46
See #1874 and #1872.
2021-10-03 07:51:37 +02:00
Martin Nordholts
405a80f3ee HighlightingAssets: Turn get_syntax_for_path() into public API 2021-09-28 07:26:20 +02:00
Martin Nordholts
9124271eaf
Load independent and minimal syntax sets when using --language (#1787)
This significantly speeds up the startup time of bat, since only a single
linked SyntaxDefinition is loaded for each file. The size increase of the
binary is just ~400 kB.

In order for startup time to be improved, the --language arg must be used, and
it must match one of the following names:

"Plain Text", "ActionScript", "AppleScript", "Batch File", "NAnt Build File",
"C#", "C", "CSS", "D", "Diff", "Erlang", "Go", "Haskell", "JSON", "Java
Properties", "BibTeX", "LaTeX Log", "TeX", "Lisp", "Lua", "MATLAB", "Pascal",
"R", "Regular Expression", "Rust", "SQL", "Scala", "Tcl", "XML", "YAML", "Apache
Conf", "ARM Assembly", "Assembly (x86_64)", "CMakeCache", "Comma Separated
Values", "Cabal", "CoffeeScript", "CpuInfo", "Dart Analysis Output", "Dart",
"Dockerfile", "DotENV", "F#", "Friendly Interactive Shell (fish)", "Fortran
(Fixed Form)", "Fortran (Modern)", "Fortran Namelist", "fstab", "GLSL",
"GraphQL", "Groff/troff", "group", "hosts", "INI", "Jinja2", "jsonnet",
"Kotlin", "Less", "LLVM", "Lean", "MemInfo", "Nim", "Ninja", "Nix", "passwd",
"PowerShell", "Protocol Buffer (TEXT)", "Puppet", "Rego", "resolv", "Robot
Framework", "SML", "Strace", "Stylus", "Solidity", "Vyper", "Swift",
"SystemVerilog", "TOML", "Terraform", "TypeScript", "TypeScriptReact",
"Verilog", "VimL", "Zig", "gnuplot", "log", "requirements.txt", "Highlight
non-printables", "Private Key", "varlink"

Later commits will improve startup time for more code paths.

* fix some typos and misspellings

* CHANGELOG.md: Add Performance section (preliminary)

* Add a CHANGELOG.md entry for this PR
2021-09-09 20:52:33 +02:00
Rashil Gandhi
43afae34be
Add PowerShell completion file (#1826) 2021-08-28 13:39:17 +02:00
Martin Nordholts
19c3e82abf
Replace deprecated 'error-chain' with 'thiserror' (#1820)
We can't use #[from] on Error::Msg(String) because String does not implement Error.
(Which it shouldn't; see e.g. https://internals.rust-lang.org/t/impl-error-for-string/8881.)
So we implement From manually for Error::Msg, since our current code was written
in that way for error-chain.
2021-08-26 13:12:21 +02:00
Martin Nordholts
f1c0fd7343
Don't take a HighlightingAssets detour to build assets (#1802)
Move code to build assets to its own file. That results in better modularity and flexibility.

It also allows us to simplify HighlightingAssets a lot, since it will now always
be initialized with a SerializedSyntaxSet.
2021-08-24 07:58:03 +02:00
Bojan Durdevic
c86a179412 PR comments addressed for line range +delta syntax 2021-08-23 19:55:41 +02:00
Bojan Durdevic
0748783404 Support for line range plus syntax 2021-08-23 19:55:41 +02:00
Martin Nordholts
b3247d9364 Merge the v0.18.3 hotfix release into master
The v0.18.3 release was a hotfix release to make bat build again with Rust 1.54.
This merge commit brings in all changes from the hotfix release into the master
branch.

In practice, this only brings in one new commit, namely b146958ec. The other
three commits in the release were cherry-picks from master.
2021-08-22 19:22:20 +02:00
Martin Nordholts
b146958ecb Bump version to v0.18.3 2021-08-22 17:47:12 +02:00
Mario Finelli
5125e9c941 Add support for ruby-slim syntax 2021-08-16 06:16:53 +02:00
Bill Risher
6c62ed5608 revamped integration test, made CHANGELOG changes 2021-08-14 22:02:58 +02:00
Bill Risher
bf78288e9e feat(config): added recognition of $BAT_CONFIG_DIR 2021-08-14 22:02:58 +02:00
Ville Skyttä
79f08588c6 Mention syslog highlight improvements in change log 2021-08-11 23:03:33 +03:00
Martin Nordholts
d8b813c0bf
When returning a SyntaxReference, also return the SyntaxSet that contains it (#1776)
To improve startup performance, we will later load smaller `SyntaxSet`s instead
of one giant one. However, the current API assumes only one `SyntaxSet` is ever used,
and that that implicitly is the `SyntaxSet` from which returned `SyntaxReference`s
comes.

This change changes the API to reflect that `SyntaxSet` and `SyntaxReference`
are tightly coupled, and enables the use of several `SyntaxSet`.
2021-08-08 08:26:17 +02:00
Keith Hall
05c11964fc add patch for Python syntax to help improve performance 2021-08-07 17:54:08 +02:00
Martin Nordholts
1ef0206f24 CHANGELOG.md: Highlight for vimrc and gvimrc files 2021-08-06 09:26:56 +02:00
Layle | Luca
51c7eb7ac1
Included LLVM syntax highlighting submodule and added regression tests 2021-08-05 20:20:33 +02:00
Keith Hall
6d5ff671e7 Add HTTP Request/Response syntax as a git submodule 2021-07-29 21:36:16 +02:00
Martin Nordholts
6acec2c074 Reduce startup time in loop-through mode with 80%-90%
Instead of 100 ms - 50 ms, startup takes 10 ms - 5 ms.

HighlightingAssets::get_syntax_set() is never called when e.g. piping the bat
output to a file (see Config::loop_through), so by loading the SyntaxSet only
when needed, we radically improve startup time when it is not needed.
2021-07-29 20:36:05 +02:00
Martin Nordholts
a81009607a HighlightingAssets: Make .syntaxes() and syntax_for_file_name() failable
Or rather, introduce new versions of these methods and deprecate the old ones.

This is preparation to enable robust and user-friendly support for lazy-loading.
With lazy-loading, we don't know if the SyntaxSet is valid until after we try to
use it, so wherever we try to use it, we need to return a Result. See discussion
about panics in #1747.
2021-07-29 08:26:18 +02:00
Martin Nordholts
ccf4563573 Make loading of cached assets closer in performance to integrated assets
Using BufReader makes sense for large files, but assets are never large enough
to require buffering. It is significantly faster to load the file contents in
one go, so let's do that instead.

Closes #1753
2021-07-27 14:53:59 +02:00
David Peter
6e536ab06d Update CHANGELOG 2021-07-25 13:28:43 +02:00
David Peter
945bba777b Upgrade CHANGELOG with security vulnerability notice 2021-07-13 10:56:51 +02:00
David Peter
a4b674902f Bump version to v0.18.2 2021-07-12 23:17:48 +02:00
David Peter
3c59b98dc8 Add CHANGELOG entry for #1687 2021-07-09 06:36:06 +02:00
Ville Skyttä
0e9d612173 Add change log entry for bash completion 2021-06-28 11:58:03 +02:00
Ville Skyttä
90e48e9b61 Spelling fixes 2021-06-13 22:08:56 +02:00
Martin Nordholts
f4217eba73
Merge pull request #1669 from sharkdp/dependabot/submodules/assets/syntaxes/02_Extra/DotENV-58201ba
Bump assets/syntaxes/02_Extra/DotENV from `a1c9176` to `58201ba`
2021-06-02 07:48:13 +02:00
Mohamed Abdelnour
14900f6ed8 Update CHANGELOG.md for #1668 2021-06-01 22:36:56 +02:00
Martin Nordholts
bcca56e3b1 CHANGELOG.md: Apply DotENV syntax also for .env.default and .env.defaults 2021-06-01 18:45:17 +02:00
Mohamed Abdelnour
cf7d9ef962 Update CHANGELOG.md for #1661 2021-05-27 12:05:07 +02:00
Mohamed Abdelnour
8435cad602 Merge master 2021-05-15 09:41:27 +02:00
Mohamed Abdelnour
6fc9641f6a Update CHANGELOG for #1655 2021-05-15 00:13:42 +02:00
Mohamed Abdelnour
ef5154d5b3 Update CHANGELOG for #1654 2021-05-14 22:12:58 +02:00
David Peter
73dab51ad1 Bump version, update dependencies 2021-05-12 22:55:25 +02:00
David Peter
9328007d05 Updated CHANGELOG 2021-05-12 22:46:44 +02:00
David Peter
5db3c93057
Merge branch 'master' into syslog 2021-05-12 11:34:35 +02:00
Keith Hall
3559079de0 Improvements to CSV highlighting 2021-05-11 21:04:02 +02:00
Ethan P
aa09a9dc04
Update changelog for #1589 2021-04-06 15:33:34 -07:00
Keith Hall
1537733e6b replace Syslog dependency with a custom syntax 2021-04-04 22:47:01 +03:00
Sean McLoughlin
d89fa3ebc2 Add SystemVerilog support 2021-03-15 07:21:15 +01:00
David Peter
52f84b063c Update dependencies, MSRV: 1.45 2021-03-07 15:33:37 +01:00
Aleksey Kladov
35347c2310 Improve readability
Using `Path`s for paths expresses intent more clearly.
2021-03-07 14:59:10 +01:00
David Peter
b147443c32 Add new unreleased section 2021-02-28 23:28:59 +01:00
David Peter
ca60937c2e Do not ignore non-existent BAT_CONFIG_PATH
Do not ignore `BAT_CONFIG_PATH` if it doesn't exist. Both when
generating a new config file with `--generate-config-file` and
when attempting to read the config.

Also, provide a better error message in case the file can not
be created.

closes #1550
2021-02-28 10:08:24 +01:00
David Peter
2aa3ed9da8 Update CHANGELOG 2021-02-28 10:06:56 +01:00
David Peter
7eabb5e05a Highlight *.pac files as JavaScript
closes #1515
2021-02-16 21:52:52 +01:00
Martin Nordholts
37d0d8984c README.md: Warn about buggy snap packages
As discussed in #1519, the batcat snap package is too problematic for
official endorsement, so withdraw recommendation from README.me (and
remove section from CHANGELOG.md since a release with it has not been
made yet).
2021-02-15 22:39:48 +01:00
Keith Hall
2e8c0a39db Add support for env vars and manpage refs with dots to Manpage syntax 2021-02-15 22:30:42 +01:00
Martin Nordholts
c48e779e8a CHANGELOG.md: Add entry for #1413 2021-01-11 21:56:10 +01:00
sharkdp
060b9981b5 Remove deprecated PrettyPrinter methods 2021-01-11 21:36:08 +01:00
Martin Nordholts
02e6ff4183 Merge remote-tracking branch 'origin/master' into fix-1063 2021-01-10 11:56:03 +01:00
sharkdp
7ada963ec2 Add ChangeLog entry 2021-01-09 22:35:50 +01:00
sharkdp
7c227169a4 Add note about breaking change 2021-01-09 20:44:44 +01:00
mark chaitin
de6cb75f4b Addressed PR feedback. Upped min version and used matches! macro 2021-01-09 15:21:26 +01:00
mark chaitin
83c9cb7907 fix bug where long lines were truncated in plain mode without wrap=never not being set 2021-01-09 15:21:26 +01:00
Martin Nordholts
da10166625 Merge remote-tracking branch 'origin/master' into fix-1063 2021-01-07 12:58:26 +01:00
sharkdp
2b44940f81 Update CHANGELOG 2021-01-06 22:55:12 +01:00
Martin Nordholts
478233f795 Merge remote-tracking branch 'origin/master' into fix-1063 2021-01-04 21:02:51 +01:00
sharkdp
7fbb3a5352 Add Zig entry in ChangeLog, see #1470 2021-01-02 21:37:11 +01:00
sharkdp
aa5b941ed5 Add ChangeLog entry 2021-01-02 09:46:58 +01:00
Martin Nordholts
bfa5342331 Also replace 'more' from PAGER with 'less'
But first do some quite significant refactorings to keep the code clean
and easy to understand.
2020-12-30 17:59:30 +01:00
Martin Nordholts
22bdc7c20f When PAGER=most, don't print a warning to stderr, silently use less instead 2020-12-30 08:25:39 +01:00
sharkdp
6d0e7650c3 Add .resource extension for Robot Framework 2020-12-29 09:04:34 +01:00
Martin Nordholts
552545fe5f Merge remote-tracking branch 'origin/master' into fix-1063 2020-12-28 22:48:52 +01:00
Martin Nordholts
dcfe883f4b Simplify and polish pager.rs and related code 2020-12-28 22:39:34 +01:00
Martin Nordholts
f45fa5e187 CHANGELOG.md: Add bugfix entry for #614 2020-12-28 22:32:56 +01:00
Martin Nordholts
cc0f8ca813 Merge remote-tracking branch 'origin/master' into fix-1063 2020-12-28 21:57:38 +01:00
sharkdp
73d9a95862 Update CHANGELOG 2020-12-28 09:36:49 +01:00
David Peter
07bd7503c5 Update CHANGELOG.md 2020-12-21 21:52:04 +01:00
John Meow
1b5af89ddd Move changelog entry to unreleased 2020-12-21 21:52:04 +01:00
John Meow
3d07dec8fd Use Briles/gruvbox .tmTheme files instead of peaceant's port 2020-12-21 21:52:04 +01:00
Mitchell Kember
3099f51ba7 Add ansi theme to replace ansi-light and ansi-dark
This combines ansi-light and ansi-dark into a single theme that works
with both light and dark backgrounds. Instead of specifying white/black,
the ansi theme uses the terminal's default foreground/background color
by setting alpha=01, i.e. #00000001. This is in addition to the alpha=00
encoding where red contains an ANSI color palette number.

Now, `--theme ansi-light` and `--theme ansi-dark` will print a
deprecation notice and use ansi instead (unless the user has a custom
theme named ansi-light or ansi-dark, which would take precedence).
2020-12-21 17:05:10 +01:00
sharkdp
19e7763f35 Add changelog entry 2020-12-21 09:42:06 +01:00
David Peter
947133d295 Update CHANGELOG.md 2020-12-21 09:24:56 +01:00
Stefan Kunkel
cffacad306 make bat -L use pager 2020-12-21 09:24:56 +01:00
David Peter
73c16574e6
Merge branch 'master' into fix-1438-newline-can-be-added-even-if-style-plain 2020-12-21 08:22:01 +01:00
Martin Nordholts
60e00d49a9
Fix #1443 macOS: regression_test.sh: mktemp: illegal option (#1444)
The macOS version of mktemp does not recognize the --suffix option.
Using pure -d should work since, it seems [1], macOS 10.11 however.

So to make the script work on macOS, stop using the --suffix option.

The downside is of course that the temporary dir will have an anonymous
name, but I see no risk of confusion given how short-lived the usage of
the dir is, and given the context it is used.

[1] https://unix.stackexchange.com/questions/30091/fix-or-alternative-for-mktemp-in-os-x
2020-12-21 08:16:49 +01:00