/doc/batgrep.md

https://github.com/eth-p/bat-extras · Markdown · 79 lines · 53 code · 26 blank · 0 comment · 0 complexity · a414fce0460eeb46e7f966fb494ce2be MD5 · raw file

  1. # bat-extras: batgrep
  2. Quickly search through and highlight files using [ripgrep](https://github.com/burntsushi/ripgrep).
  3. Search through files or directories looking for matching regular expressions (or fixed strings with `-F`), and print the output using `bat` for an easy and syntax-highlighted experience.
  4. ## Usage
  5. batgrep [OPTIONS] PATTERN [PATH...]
  6. ## Options
  7. | Short | Long | Description |
  8. | ----- | ---------------------------- | ------------------------------------------------------------ |
  9. | `-i` | `--ignore-case` | Use case insensitive searching. |
  10. | `-s` | `--case-sensitive` | Use case sensitive searching. |
  11. | `-S` | `--smart-case` | Use smart case searching. |
  12. | `-A` | `--after-context=[LINES]` | Display the next *n* lines after a matched line. |
  13. | `-B` | `--before-context=[LINES]` | Display the previous `n` lines before a matched line. |
  14. | `-C` | `--context=[LINES]` | A combination of `--after-context` and `--before-context`. |
  15. | `-p` | `--search-pattern` | Tell pager to search for `PATTERN`. Currently supported pagers: `less`. |
  16. | | `--no-follow` | Do not follow symlinks. |
  17. | | `--no-snip` | Do not show the `snip` decoration.<br /><br />This is automatically enabled when `--context=0` or when `bat --version` is less than `0.12.x`. |
  18. | | `--no-highlight` | Do not highlight matching lines.<br /><br />This is automatically enabled when `--context=0`. |
  19. | | `--color` | Force color output. |
  20. | | `--no-color` | Force disable color output. |
  21. | | `--paging=["never"/"always"]`| Enable/disable paging. |
  22. | | `--pager=[PAGER]` | Specify the pager to use. |
  23. | | `--terminal-width=[COLS]` | Generate output for the specified terminal width. |
  24. The following options are passed directly to ripgrep, and are not handled by this script.
  25. | Short | Long | Notes |
  26. | ----- | -------------------------- | ------------------------------------------------------------ |
  27. | `-F` | `--fixed-strings` | |
  28. | `-U` | `--multiline` | |
  29. | `-P` | `--pcre2` | |
  30. | `-z` | `--search-zip` | |
  31. | `-w` | `--word-regexp` | |
  32. | | `--one-file-system` | |
  33. | | `--multiline-dotall` | |
  34. | | `--ignore` / `--no-ignore` | |
  35. | | `--crlf` / `--no-crlf` | |
  36. | | `--hidden` / `--no-hidden` | |
  37. | `-E` | `--encoding` | This is unsupported by `bat`, and may cause issues when trying to display unsupported encodings. |
  38. | `-g` | `--glob` | |
  39. | `-t` | `--type` | |
  40. | `-T` | `--type-not` | |
  41. | `-m` | `--max-count` | |
  42. | | `--max-depth` | |
  43. | | `--iglob` | |
  44. | | `--ignore-file` | |
  45. ## Installation
  46. This script is a part of the `bat-extras` suite of scripts. You can find install instructions [here](../README.md#installation).
  47. ## Caveats
  48. **Differences from ripgrep:**
  49. - `--follow` is enabled by default for `batgrep`.
  50. - Not all the `ripgrep` options are supported.
  51. ## Issues?
  52. If you find an issue or have a feature suggestion, make a pull request or issue through GitHub!
  53. Contributions are always welcome.