summaryrefslogtreecommitdiffstats
path: root/manual/src/grep.md
diff options
context:
space:
mode:
Diffstat (limited to 'manual/src/grep.md')
-rw-r--r--manual/src/grep.md22
1 files changed, 18 insertions, 4 deletions
diff --git a/manual/src/grep.md b/manual/src/grep.md
index 60a61d07..a090389c 100644
--- a/manual/src/grep.md
+++ b/manual/src/grep.md
@@ -2,19 +2,33 @@
Delta applies syntax-highlighting and other enhancements to standard grep output such as from [ripgrep](https://github.com/BurntSushi/ripgrep/) (aka `rg`), `git grep`, grep, etc.
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`.
+To customize the colors and syntax highlighting, see the `grep-*` options in `delta --help`.
+
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
+rg --json -C 2 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>
+<table><tr><td>
+<img width="600px" alt="image" src="https://github.com/dandavison/open-in-editor/assets/52205/d203d380-5acb-4296-aeb9-e38c73d6c27f">
+</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. If you're using VSCode, IntelliJ, or PyCharm, then use the dedicated URL handlers. I.e. one of the following lines:
+
+```gitconfig
+[delta]
+ hyperlinks = true
+ hyperlinks-file-link-format = "vscode://file/{path}:{line}"
+ # or: hyperlinks-file-link-format = "idea://open?file={path}&line={line}"
+ # or: hyperlinks-file-link-format = "pycharm://open?file={path}&line={line}"
+```
-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/>).
+For editors that don't have special URL handlers, it is possible to use a tool like <https://github.com/dandavison/open-in-editor/> to make your OS handle a click on those links by opening your editor at the correct file and line number, e.g.
```gitconfig
[delta]
hyperlinks = true
hyperlinks-file-link-format = "file-line://{path}:{line}"
+ # Now configure your OS to handle "file-line" URLs
```