summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/CICD.yml5
-rw-r--r--.gitmodules9
-rw-r--r--CHANGELOG.md12
-rw-r--r--CONTRIBUTING.md48
-rw-r--r--README.md65
-rw-r--r--assets/completions/bat.zsh.in20
-rw-r--r--assets/patches/ShellScript.sublime-syntax.patch15
-rw-r--r--assets/syntaxes/02_Extra/Manpage.sublime-syntax160
m---------assets/syntaxes/02_Extra/Ninja0
-rw-r--r--assets/syntaxes/02_Extra/Ninja.sublime-syntax52
m---------assets/syntaxes/02_Extra/Svelte0
-rw-r--r--assets/syntaxes/02_Extra/syntax_test_man.man151
-rw-r--r--assets/themes.binbin16672 -> 18538 bytes
m---------assets/themes/Coldark0
-rw-r--r--doc/assets.md (renamed from assets/README.md)18
-rw-r--r--doc/logo-header.svg2
-rw-r--r--src/bin/bat/main.rs8
-rw-r--r--src/error.rs4
-rw-r--r--src/output.rs4
-rw-r--r--tests/assets.rs4
-rw-r--r--tests/integration_tests.rs10
-rwxr-xr-xtests/syntax-tests/create_highlighted_versions.py3
-rw-r--r--tests/syntax-tests/highlighted/ActionScript/test.as75
-rw-r--r--tests/syntax-tests/highlighted/Apache/httpd.conf42
-rw-r--r--tests/syntax-tests/highlighted/D/test.d44
-rw-r--r--tests/syntax-tests/highlighted/DotENV/.env57
-rw-r--r--tests/syntax-tests/highlighted/EtcGroup/test.group67
-rw-r--r--tests/syntax-tests/highlighted/Git Attributes/example.gitattributes16
-rw-r--r--tests/syntax-tests/highlighted/Git Config/text.gitconfig107
-rw-r--r--tests/syntax-tests/highlighted/Graphviz DOT/test_digraph.dot41
-rw-r--r--tests/syntax-tests/highlighted/Graphviz DOT/test_graph.dot3
-rw-r--r--tests/syntax-tests/highlighted/Hosts/hosts8
-rw-r--r--tests/syntax-tests/highlighted/Lisp/utils.lisp80
-rw-r--r--tests/syntax-tests/highlighted/MATLAB/test.matlab34
-rw-r--r--tests/syntax-tests/highlighted/Makefile/Makefile385
-rw-r--r--tests/syntax-tests/highlighted/Manpage/bat-0.16.man243
-rw-r--r--tests/syntax-tests/highlighted/Manpage/select-2.man330
-rw-r--r--tests/syntax-tests/highlighted/Ninja/test.ninja6
-rw-r--r--tests/syntax-tests/highlighted/Perl/test.pl157
-rw-r--r--tests/syntax-tests/highlighted/PowerShell/test.ps125
-rw-r--r--tests/syntax-tests/highlighted/PureScript/test.purs89
-rw-r--r--tests/syntax-tests/highlighted/QML/BatSyntaxTest.qml219
-rw-r--r--tests/syntax-tests/highlighted/RequirementsTXT/requirements.txt8
-rw-r--r--tests/syntax-tests/highlighted/SLS/test.sls57
-rw-r--r--tests/syntax-tests/highlighted/Sass/example.sass76
-rw-r--r--tests/syntax-tests/highlighted/Svelte/App.svelte57
-rw-r--r--tests/syntax-tests/highlighted/Vue/example.vue55
-rw-r--r--tests/syntax-tests/highlighted/YAML/example.yaml16
-rw-r--r--tests/syntax-tests/highlighted/nginx/nginx.conf140
-rw-r--r--tests/syntax-tests/highlighted/nim/main.nim41
-rw-r--r--tests/syntax-tests/highlighted/nix/test.nix15
-rw-r--r--tests/syntax-tests/highlighted/orgmode/test.org38
-rw-r--r--tests/syntax-tests/highlighted/reStructuredText/reference.rst320
-rw-r--r--tests/syntax-tests/source/ActionScript/test.as75
-rw-r--r--tests/syntax-tests/source/Apache/httpd.conf42
-rw-r--r--tests/syntax-tests/source/D/test.d44
-rw-r--r--tests/syntax-tests/source/DotENV/.env57
-rw-r--r--tests/syntax-tests/source/DotENV/LICENSE.md23
-rw-r--r--tests/syntax-tests/source/EtcGroup/test.group67
-rw-r--r--tests/syntax-tests/source/Git Attributes/example.gitattributes16
-rw-r--r--tests/syntax-tests/source/Git Config/LICENSE.md1
-rw-r--r--tests/syntax-tests/source/Git Config/text.gitconfig107
-rw-r--r--tests/syntax-tests/source/Graphviz DOT/LICENSE.md22
-rw-r--r--tests/syntax-tests/source/Graphviz DOT/test_digraph.dot41
-rw-r--r--tests/syntax-tests/source/Graphviz DOT/test_graph.dot3
-rw-r--r--tests/syntax-tests/source/Hosts/hosts8
-rw-r--r--tests/syntax-tests/source/Lisp/LICENSE.md24
-rw-r--r--tests/syntax-tests/source/Lisp/utils.lisp80
-rw-r--r--tests/syntax-tests/source/MATLAB/LICENSE.md27
-rw-r--r--tests/syntax-tests/source/MATLAB/test.matlab34
-rw-r--r--tests/syntax-tests/source/Makefile/LICENSE.md12
-rw-r--r--tests/syntax-tests/source/Makefile/Makefile385
-rw-r--r--tests/syntax-tests/source/Manpage/bat-0.16.man243
-rw-r--r--tests/syntax-tests/source/Manpage/select-2.man330
-rw-r--r--tests/syntax-tests/source/Ninja/LICENSE.md204
-rw-r--r--tests/syntax-tests/source/Ninja/test.ninja6
-rw-r--r--tests/syntax-tests/source/Perl/test.pl157
-rwxr-xr-xtests/syntax-tests/source/PowerShell/test.ps1bin0 -> 1430 bytes
-rw-r--r--tests/syntax-tests/source/PureScript/test.purs89
-rw-r--r--tests/syntax-tests/source/QML/BatSyntaxTest.qml219
-rw-r--r--tests/syntax-tests/source/RequirementsTXT/requirements.txt8
-rw-r--r--tests/syntax-tests/source/SLS/test.sls57
-rw-r--r--tests/syntax-tests/source/Sass/example.sass76
-rw-r--r--tests/syntax-tests/source/Svelte/App.svelte57
-rw-r--r--tests/syntax-tests/source/Svelte/LICENSE14
-rw-r--r--tests/syntax-tests/source/Vue/example.vue55
-rw-r--r--tests/syntax-tests/source/YAML/example.yaml18
-rw-r--r--tests/syntax-tests/source/nginx/nginx.conf140
-rw-r--r--tests/syntax-tests/source/nim/main.nim41
-rw-r--r--tests/syntax-tests/source/nix/test.nix15
-rw-r--r--tests/syntax-tests/source/orgmode/test.org38
-rw-r--r--tests/syntax-tests/source/reStructuredText/reference.rst320
92 files changed, 6530 insertions, 66 deletions
diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml
index 5ff77927..19d4e927 100644
--- a/.github/workflows/CICD.yml
+++ b/.github/workflows/CICD.yml
@@ -58,6 +58,11 @@ jobs:
with:
command: test
args: --release
+ - name: Run ignored-by-default unit tests with new syntaxes and themes
+ uses: actions-rs/cargo@v1
+ with:
+ command: test
+ args: --release -- --ignored
- name: Syntax highlighting regression test
run: tests/syntax-tests/regression_test.sh
- name: List of languages
diff --git a/.gitmodules b/.gitmodules
index 1d94f27e..3e71c7bd 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -197,3 +197,12 @@
[submodule "assets/syntaxes/02_Extra/Apache"]
path = assets/syntaxes/02_Extra/Apache
url = https://github.com/colinta/ApacheConf.tmLanguage
+[submodule "assets/syntaxes/02_Extra/Ninja"]
+ path = assets/syntaxes/02_Extra/Ninja
+ url = https://github.com/pope/SublimeNinja.git
+[submodule "assets/syntaxes/02_Extra/Svelte"]
+ path = assets/syntaxes/02_Extra/Svelte
+ url = https://github.com/corneliusio/svelte-sublime
+[submodule "assets/themes/Coldark"]
+ path = assets/themes/Coldark
+ url = https://github.com/ArmandPhilippot/coldark-bat.git
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2a549f93..ba6f7235 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,5 @@
# unreleased
-- Add Note to refer to see detailed help with --help (and vice versa with -h). see #1215 (@henil)
## Features
@@ -9,12 +8,23 @@
## Bugfixes
+- Throws an error when `bat` is being used as `pager`, see #1343 (@adrian-rivera)
+- Bash syntax highlighting not selected for `*.ebuild` and `*.eclass` files, see #1292 (@sharkdp)
+
## Other
+- Add note to refer to see detailed help with `--help` (and vice versa with `-h`), see #1215 (@henil)
+- Add a `Contributors` section to `README`, see #1348 (@adrian-rivera)
+
## Syntaxes
+- Manpage syntax highlighting has been improved, see #1315 (@keith-hall)
+- Add Svelte file syntax, see #1285 (@kjmph)
+
## New themes
+- Coldark, see #1329 (@armandphilippot)
+
## `bat` as a library
## Packaging
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 00000000..dca1d0f3
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,48 @@
+# Contributing
+
+Thank you for considering to contribute to `bat`!
+
+
+
+## Add an entry to the changelog
+
+If your contribution changes the behavior of `bat` (as opposed to a typo-fix
+in the documentation), please update the [`CHANGELOG.md`](CHANGELOG.md) file
+and describe your changes. This makes the release proess much easier and
+therefore helps to get your changes into a new `bat` release faster.
+
+The top of the `CHANGELOG` contains a *"unreleased"* section with a few
+subsections (Features, Bugfixes, …). Please add your entry to the subsection
+that best describes your change
+
+Entries follow this format:
+```
+- Short description of what has been changed, see #123 (@user)
+```
+Here, `#123` is the number of the original issue and/or your pull request.
+Please replace `@user` by your GitHub username.
+
+
+## Development
+
+Please check out the [Development](https://github.com/sharkdp/bat#development)
+section in the README.
+
+
+## Adding a new feature
+
+Please consider opening a
+[feature request ticket](https://github.com/sharkdp/bat/issues/new?assignees=&labels=feature-request&template=feature_request.md)
+first in order to give us a chance to discuss the feature first.
+
+
+## Adding new syntaxes/languages or themes
+
+Before you make a pull request that adds a new syntax or theme, please read
+the [Customization](https://github.com/sharkdp/bat#customization) section
+in the README first.
+
+If you really think that a particular syntax or theme should be added for all
+users, please read the corresponding
+[documentation](https://github.com/sharkdp/bat/blob/master/doc/assets.md)
+first.
diff --git a/README.md b/README.md
index d4703245..f04e6a1c 100644
--- a/README.md
+++ b/README.md
@@ -131,7 +131,18 @@ highlighting:
git show v0.6.0:src/main.rs | bat -l rs
```
-Note that syntax highlighting within diffs is currently not supported. If you are looking for this, check out [`delta`](https://github.com/dandavison/delta).
+#### `git diff`
+
+You can combine `bat` with `git diff` to view lines around code changes with proper syntax
+highlighting:
+```bash
+batdiff() {
+ git diff --name-only --diff-filter=d | xargs bat --diff
+}
+```
+If you prefer to use this as a separate tool, check out `batdiff` in [`bat-extras`](https://github.com/eth-p/bat-extras).
+
+If you are looking for more support for git and diff operations, check out [`delta`](https://github.com/dandavison/delta).
#### `xclip`
@@ -336,7 +347,7 @@ higher. You can then use `cargo` to build everything:
cargo install --locked bat
```
-Note that addition files like the man page or shell completion
+Note that additional files like the man page or shell completion
files can not be installed in this way. They will be generated by `cargo` and should be available in the cargo target folder (under `build`).
## Customization
@@ -391,35 +402,45 @@ variable to make these changes permanent or use `bat`s
### Adding new syntaxes / language definitions
+Should you find that a particular syntax is not available within `bat`, you can follow these
+instructions to easily add new syntaxes to your current `bat` installation.
+
`bat` uses the excellent [`syntect`](https://github.com/trishume/syntect/)
library for syntax highlighting. `syntect` can read any
[Sublime Text `.sublime-syntax` file](https://www.sublimetext.com/docs/3/syntax.html)
-and theme. To add new syntax definitions, do the following.
+and theme.
-Create a folder with syntax definition files:
+A good resource for finding Sublime Syntax packages is [Package Control](https://packagecontrol.io/). Once you found a
+syntax:
-```bash
-mkdir -p "$(bat --config-dir)/syntaxes"
-cd "$(bat --config-dir)/syntaxes"
+1. Create a folder with syntax definition files:
-# Put new '.sublime-syntax' language definition files
-# in this folder (or its subdirectories), for example:
-git clone https://github.com/tellnobody1/sublime-purescript-syntax
-```
+ ```bash
+ mkdir -p "$(bat --config-dir)/syntaxes"
+ cd "$(bat --config-dir)/syntaxes"
-Now use the following command to parse these files into a binary cache:
+ # Put new '.sublime-syntax' language definition files
+ # in this folder (or its subdirectories), for example:
+ git clone https://github.com/tellnobody1/sublime-purescript-syntax
+ ```
-```bash
-bat cache --build
-```
+2. Now use the following command to parse these files into a binary cache:
-Finally, use `bat --list-languages` to check if the new languages are available.
+ ```bash
+ bat cache --build
+ ```
-If you ever want to go back to the default settings, call:
+3. Finally, use `bat --list-languages` to check if the new languages are available.
-```bash
-bat cache --clear
-```
+ If you ever want to go back to the default settings, call:
+
+ ```bash
+ bat cache --clear
+ ```
+
+4. If you think that a specific syntax should be included in `bat` by default, please
+ consider opening a "syntax request" ticket after reading the policies and
+ instructions [here](doc/assets.md): [Open Syntax Request](https://github.com/sharkdp/bat/issues/new?labels=syntax-request&template=syntax_request.md).
### Adding new themes
@@ -655,6 +676,10 @@ bash assets/create.sh
cargo install --path . --locked --force
```
+## Contributing
+
+Take a look at the [`CONTRIBUTING.md`](CONTRIBUTING.md) guide.
+
## Maintainers
- [sharkdp](https://github.com/sharkdp)
diff --git a/assets/completions/bat.zsh.in b/assets/completions/bat.zsh.in
index cef5daaa..edaf7aee 100644
--- a/assets/completions/bat.zsh.in
+++ b/assets/completions/bat.zsh.in
@@ -3,8 +3,8 @@
local context state state_descr line
typeset -A opt_args
-(( $+functions[_cache_subcommand] )) ||
-_cache_subcommand() {
+(( $+functions[_{{PROJECT_EXECUTABLE}}_cache_subcommand] )) ||
+_{{PROJECT_EXECUTABLE}}_cache_subcommand