diff options
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. @@ -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 |