summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Davison <dandavison7@gmail.com>2023-03-15 05:52:44 -0400
committerDan Davison <dandavison7@gmail.com>2023-03-15 05:54:36 -0400
commit23a8070aaf3ff644accc460b1b0aa72fa8971ca2 (patch)
tree08d9036a16ca186411ec71e0e03fff33ecf36bbd
parent4058ce12ea7fb26f21bee4f1541a06c6b63a88a9 (diff)
Improve `grep` documentation
-rw-r--r--README.md6
-rw-r--r--manual/src/grep.md14
2 files changed, 20 insertions, 0 deletions
diff --git a/README.md b/README.md
index 9582598f..302de0de 100644
--- a/README.md
+++ b/README.md
@@ -180,6 +180,12 @@ Side-by-side view wraps long lines automatically:
<table><tr><td><img width=600px src="https://user-images.githubusercontent.com/52205/141891376-1fdb87dc-1d9c-4ad6-9d72-eeb19a8aeb0b.png" alt="image" /></td></tr></table>
+### Ripgrep, git grep
+
+[[User manual](https://dandavison.github.io/delta/grep.html)]
+
+<table><tr><td><img width=400px src="https://user-images.githubusercontent.com/52205/225271024-a01367f0-af1b-466a-9b9e-b1ced7f80031.png" alt="image" /></td></tr></table>
+
### Installation and usage
Please see the [user manual](https://dandavison.github.io/delta/) and `delta --help`.
diff --git a/manual/src/grep.md b/manual/src/grep.md
index cd1e129d..60a61d07 100644
--- a/manual/src/grep.md
+++ b/manual/src/grep.md
@@ -4,3 +4,17 @@ Delta applies syntax-highlighting and other enhancements to standard grep output
If you don't need special features of `git grep`, then for best results pipe `rg --json` output to delta: this avoids parsing ambiguities that are inevitable with the output of `git grep` and `grep`.
To customize the colors and syntax highlighting, see `grep-match-line-style`, `grep-match-word-style`, `grep-context-line-style`, `grep-file-style`, `grep-line-number-style`.
Note that `git grep` can display the "function context" for matches and that delta handles this output specially: see the `-p` and `-W` options of `git grep`.
+
+```sh
+rg --json handle | delta
+```
+
+<table><tr><td><img width=400px src="https://user-images.githubusercontent.com/52205/225271024-a01367f0-af1b-466a-9b9e-b1ced7f80031.png" alt="image" /></td></tr></table>
+
+If you enable hyperlinks then grep hits will be formatted as [OSC8 hyperlinks](https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda) in terminal emulators that support the feature. It is then possible to make your OS handle a click on those links by opening your editor at the correct file and line number (e.g. via <https://github.com/dandavison/open-in-editor/>).
+
+```gitconfig
+[delta]
+ hyperlinks = true
+ hyperlinks-file-link-format = "file-line://{path}:{line}"
+```